@@ -170,34 +170,8 @@ else if (xmt == XMaterial.CHEST)
170170 }
171171 else {
172172 Object a = Material .matchMaterial (text );
173- if (a != null && a .equals (Material .GRASS_BLOCK ))
174- a = null ;
175- if (a == null ) {
176- switch (plugin .placetype ) {
177- case ItemsAdder :
178- CustomBlock customBlock = CustomBlock .getInstance (text );
179- if (customBlock != null )
180- a = customBlock ;
181- break ;
182- case Oraxen :
183- if (OraxenItems .exists (text ))
184- a = text ;
185- break ;
186- case Nexo :
187- if (NexoBlocks .isCustomBlock (text ))
188- a = text ;
189- break ;
190- case CraftEngine :
191- String [] pcid = text .split (":" , 2 );
192- if (pcid .length == 2 ) {
193- Key key = Key .of (pcid );
194- if (CraftEngineBlocks .byId (key ) != null )
195- a = key ;
196- }
197- break ;
198- default : break ;
199- }
200- }
173+ if (a == null || a == Material .GRASS_BLOCK )
174+ a = getCustomBlock (text );
201175 plugin .blocks .add (a );
202176 }
203177 }
@@ -211,6 +185,19 @@ else if (xmt == XMaterial.CHEST)
211185 SetupProgressBar ();
212186 }
213187
188+ private Object getCustomBlock (String text ) {
189+ return switch (plugin .placetype ) {
190+ case ItemsAdder -> CustomBlock .getInstance (text );
191+ case Oraxen -> OraxenItems .exists (text ) ? text : null ;
192+ case Nexo -> NexoBlocks .isCustomBlock (text ) ? text : null ;
193+ case CraftEngine -> {
194+ String [] pcid = text .split (":" , 2 );
195+ yield pcid .length == 2 ? Key .of (pcid ) : null ;
196+ }
197+ default -> null ;
198+ };
199+ }
200+
214201 public void SetupProgressBar () {
215202 if (superlegacy ) return ;
216203 if (PlayerInfo .size () == 0 ) return ;
0 commit comments