2222import org .bukkit .plugin .java .JavaPlugin ;
2323import org .bukkit .potion .PotionEffect ;
2424
25+ import io .github .thebusybiscuit .slimefun4 .api .items .ItemGroup ;
26+ import io .github .thebusybiscuit .slimefun4 .api .items .SlimefunItem ;
27+ import io .github .thebusybiscuit .slimefun4 .api .items .SlimefunItemStack ;
28+ import io .github .thebusybiscuit .slimefun4 .api .recipes .RecipeType ;
2529import io .github .thebusybiscuit .slimefun4 .api .SlimefunAddon ;
30+ import io .github .thebusybiscuit .slimefun4 .libraries .dough .common .ChatColors ;
31+ import io .github .thebusybiscuit .slimefun4 .libraries .dough .common .CommonPatterns ;
32+ import io .github .thebusybiscuit .slimefun4 .libraries .dough .config .Config ;
33+ import io .github .thebusybiscuit .slimefun4 .libraries .dough .items .CustomItemStack ;
34+ import io .github .thebusybiscuit .slimefun4 .libraries .dough .skins .PlayerHead ;
35+ import io .github .thebusybiscuit .slimefun4 .libraries .dough .skins .PlayerSkin ;
36+ import io .github .thebusybiscuit .slimefun4 .libraries .dough .updater .GitHubBuildsUpdater ;
2637import io .github .thebusybiscuit .slimefun4 .implementation .SlimefunItems ;
27- import io .github .thebusybiscuit .slimefun4 .utils .PatternUtils ;
2838import io .github .thebusybiscuit .slimefunluckyblocks .surprises .CustomItemSurprise ;
2939import io .github .thebusybiscuit .slimefunluckyblocks .surprises .LuckLevel ;
3040import io .github .thebusybiscuit .slimefunluckyblocks .surprises .Surprise ;
7989import io .github .thebusybiscuit .slimefunluckyblocks .surprises .unlucky .WalshrusSurprise ;
8090import io .github .thebusybiscuit .slimefunluckyblocks .surprises .unlucky .WitchSurprise ;
8191import io .github .thebusybiscuit .slimefunluckyblocks .surprises .unlucky .ZombiePigmenSurprise ;
82- import me .mrCookieSlime .Slimefun .Lists .RecipeType ;
83- import me .mrCookieSlime .Slimefun .Objects .Category ;
84- import me .mrCookieSlime .Slimefun .Objects .SlimefunItem .SlimefunItem ;
8592import me .mrCookieSlime .Slimefun .api .BlockStorage ;
86- import me .mrCookieSlime .Slimefun .api .SlimefunItemStack ;
87- import me .mrCookieSlime .Slimefun .cscorelib2 .chat .ChatColors ;
88- import me .mrCookieSlime .Slimefun .cscorelib2 .config .Config ;
89- import me .mrCookieSlime .Slimefun .cscorelib2 .item .CustomItem ;
90- import me .mrCookieSlime .Slimefun .cscorelib2 .skull .SkullBlock ;
91- import me .mrCookieSlime .Slimefun .cscorelib2 .skull .SkullItem ;
92- import me .mrCookieSlime .Slimefun .cscorelib2 .updater .GitHubBuildsUpdater ;
93- import me .mrCookieSlime .Slimefun .cscorelib2 .updater .Updater ;
9493
9594public class SlimefunLuckyBlocks extends JavaPlugin implements SlimefunAddon {
9695
@@ -107,32 +106,28 @@ public void onEnable() {
107106 // Setting up bStats
108107 new Metrics (this , 4858 );
109108
110- if (getDescription ().getVersion ().startsWith ("DEV - " )) {
111- Updater updater = new GitHubBuildsUpdater (this , getFile (), "TheBusyBiscuit/luckyblocks-sf/master" );
112-
113- if (cfg .getBoolean ("options.auto-update" )) {
114- updater .start ();
115- }
109+ if (cfg .getBoolean ("options.auto-update" ) && getDescription ().getVersion ().startsWith ("DEV - " )) {
110+ new GitHubBuildsUpdater (this , getFile (), "TheBusyBiscuit/luckyblocks-sf/master" ).start ();
116111 }
117112
118- Category category = new Category (new NamespacedKey (this , "lucky_blocks" ), new CustomItem ( SkullItem . fromHash ( TEXTURE ), "&rLucky Blocks" ));
113+ ItemGroup itemGroup = new ItemGroup (new NamespacedKey (this , "lucky_blocks" ), new CustomItemStack ( PlayerHead . getItemStack ( PlayerSkin . fromHashCode ( TEXTURE ) ), "&rLucky Blocks" ));
119114
120115 SlimefunItemStack luckyBlock = new SlimefunItemStack ("LUCKY_BLOCK" , TEXTURE , "&fLucky Block" , "&7Luck: &f0" );
121116 SlimefunItemStack veryLuckyBlock = new SlimefunItemStack ("LUCKY_BLOCK_LUCKY" , TEXTURE , "&fVery lucky Block" , "&7Luck: &a+80" );
122117 SlimefunItemStack veryUnluckyBlock = new SlimefunItemStack ("LUCKY_BLOCK_UNLUCKY" , TEXTURE , "&fVery unlucky Block" , "&7Luck: &c-80" );
123118 SlimefunItemStack pandorasBox = new SlimefunItemStack ("PANDORAS_BOX" , "86c7dde512871bd607b77e6635ad39f44f2d5b4729e60273f1b14fba9a86a" , "&5Pandora\" s Box" , "&7Luck: &c&oERROR" );
124119
125120 // @formatter:off
126- new LuckyBlock (category , luckyBlock , RecipeType .ENHANCED_CRAFTING_TABLE ,
121+ new LuckyBlock (itemGroup , luckyBlock , RecipeType .ENHANCED_CRAFTING_TABLE ,
127122 new ItemStack [] { SlimefunItems .GOLD_12K , SlimefunItems .GOLD_12K , SlimefunItems .GOLD_12K , SlimefunItems .GOLD_12K , new ItemStack (Material .DISPENSER ), SlimefunItems .GOLD_12K , SlimefunItems .GOLD_12K , SlimefunItems .GOLD_12K , SlimefunItems .GOLD_12K }).register (this , surprises , s -> s .getLuckLevel () != LuckLevel .PANDORA );
128123
129- new LuckyBlock (category , veryLuckyBlock , RecipeType .ENHANCED_CRAFTING_TABLE ,
124+ new LuckyBlock (itemGroup , veryLuckyBlock , RecipeType .ENHANCED_CRAFTING_TABLE ,
130125 new ItemStack [] { null , SlimefunItems .GOLD_12K , null , SlimefunItems .GOLD_12K , luckyBlock , SlimefunItems .GOLD_12K , null , SlimefunItems .GOLD_12K , null }).register (this , surprises , s -> s .getLuckLevel () == LuckLevel .LUCKY );
131126
132- new LuckyBlock (category , veryUnluckyBlock , RecipeType .ENHANCED_CRAFTING_TABLE ,
127+ new LuckyBlock (itemGroup , veryUnluckyBlock , RecipeType .ENHANCED_CRAFTING_TABLE ,
133128 new ItemStack [] { null , new ItemStack (Material .SPIDER_EYE ), null , new ItemStack (Material .SPIDER_EYE ), luckyBlock , new ItemStack (Material .SPIDER_EYE ), null , new ItemStack (Material .SPIDER_EYE ), null }).register (this , surprises , s -> s .getLuckLevel () == LuckLevel .UNLUCKY );
134129
135- new LuckyBlock (category , pandorasBox , RecipeType .ENHANCED_CRAFTING_TABLE ,
130+ new LuckyBlock (itemGroup , pandorasBox , RecipeType .ENHANCED_CRAFTING_TABLE ,
136131 new ItemStack [] { new ItemStack (Material .OAK_PLANKS ), new ItemStack (Material .LAPIS_BLOCK ), new ItemStack (Material .OAK_PLANKS ), new ItemStack (Material .LAPIS_BLOCK ), luckyBlock , new ItemStack (Material .LAPIS_BLOCK ), new ItemStack (Material .OAK_PLANKS ), new ItemStack (Material .LAPIS_BLOCK ), new ItemStack (Material .OAK_PLANKS ) }).register (this , surprises , s -> s .getLuckLevel () == LuckLevel .PANDORA );
137132 // @formatter:on
138133
@@ -233,7 +228,7 @@ private void registerCustomSurprises() {
233228
234229 if (cfg .getString (itemPath + ".slimefun_item" ) != null ) {
235230 String id = cfg .getString (itemPath + ".slimefun_item" ).toUpperCase (Locale .ROOT );
236- SlimefunItem sfItem = SlimefunItem .getByID (id );
231+ SlimefunItem sfItem = SlimefunItem .getById (id );
237232
238233 if (sfItem != null ) {
239234 item = sfItem .getItem ();
@@ -273,7 +268,7 @@ private void registerCustomSurprises() {
273268
274269 if (enchantment != null ) {
275270 if (split .length == 2 ) {
276- if (!PatternUtils .NUMERIC .matcher (split [1 ]).matches ()) {
271+ if (!CommonPatterns .NUMERIC .matcher (split [1 ]).matches ()) {
277272 getLogger ().log (Level .WARNING , "Could not set \" {0}\" enchant with level \" {1}\" for custom surprise \" {2}\" " , new Object [] { enchName , split [1 ], name });
278273 continue ;
279274 }
@@ -344,7 +339,7 @@ public void spawnLuckyBlock(Block b) {
344339 });
345340
346341 b .setBlockData (data );
347- SkullBlock . setFromHash (b , TEXTURE );
342+ PlayerHead . setSkin (b , PlayerSkin . fromHashCode ( TEXTURE ), true );
348343 BlockStorage .store (b , "LUCKY_BLOCK" );
349344
350345 if (getCfg ().getBoolean ("debug" )) {
0 commit comments