Skip to content

Commit fa6c871

Browse files
Merge pull request #37 from variananora/rc-27-update
Update to RC-27
2 parents 63b1553 + 3fefce7 commit fa6c871

37 files changed

+162
-171
lines changed

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@
104104
<dependency>
105105
<groupId>com.github.TheBusyBiscuit</groupId>
106106
<artifactId>Slimefun4</artifactId>
107-
<version>RC-21</version>
107+
<version>RC-27</version>
108108
<scope>provided</scope>
109109
<exclusions>
110110
<exclusion>
111-
<groupId>io.github.thebusybiscuit</groupId>
112-
<artifactId>cscorelib2</artifactId>
111+
<groupId>io.github.baked-libs</groupId>
112+
<artifactId>dough-api</artifactId>
113113
</exclusion>
114114
</exclusions>
115115
</dependency>

src/main/java/io/github/thebusybiscuit/hotbarpets/HotbarPet.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
import java.util.Map;
55
import java.util.UUID;
66

7+
import org.bukkit.ChatColor;
78
import org.bukkit.entity.Player;
89
import org.bukkit.inventory.ItemStack;
910

10-
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
11-
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
12-
import me.mrCookieSlime.Slimefun.Objects.Category;
13-
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
14-
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
11+
import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
12+
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
13+
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
14+
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
1515

1616
public class HotbarPet extends SlimefunItem {
1717

@@ -20,8 +20,8 @@ public class HotbarPet extends SlimefunItem {
2020

2121
private final ItemStack food;
2222

23-
public HotbarPet(Category category, SlimefunItemStack item, ItemStack food, ItemStack[] recipe) {
24-
super(category, item, RecipeType.ENHANCED_CRAFTING_TABLE, recipe);
23+
public HotbarPet(ItemGroup itemGroup, SlimefunItemStack item, ItemStack food, ItemStack[] recipe) {
24+
super(itemGroup, item, RecipeType.ENHANCED_CRAFTING_TABLE, recipe);
2525
this.food = food;
2626
}
2727

@@ -42,7 +42,7 @@ public ItemStack getFavouriteFood() {
4242
public boolean checkAndConsumeFood(Player player) {
4343
if (!player.getInventory().containsAtLeast(getFavouriteFood(), 1)) {
4444
if (messageDelay.getOrDefault(player.getUniqueId(), 0L) <= System.currentTimeMillis()) {
45-
SlimefunPlugin.getLocalization().sendMessage(player, "hotbarpets.neglected-pet", true, msg -> msg.replace("%pet%", getItemName()));
45+
player.sendMessage(ChatColor.BLUE + "Your " + getItemName() + "would have helped you if you did not neglect it by not feeding it :(");
4646
messageDelay.put(player.getUniqueId(), System.currentTimeMillis() + MESSAGE_DELAY);
4747
}
4848

src/main/java/io/github/thebusybiscuit/hotbarpets/HotbarPets.java

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,14 @@
2020
import io.github.thebusybiscuit.hotbarpets.listeners.SoulPieListener;
2121
import io.github.thebusybiscuit.hotbarpets.listeners.TNTListener;
2222
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
23-
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
24-
import me.mrCookieSlime.Slimefun.Objects.Category;
25-
import me.mrCookieSlime.Slimefun.cscorelib2.config.Config;
26-
import me.mrCookieSlime.Slimefun.cscorelib2.item.CustomItem;
27-
import me.mrCookieSlime.Slimefun.cscorelib2.skull.SkullItem;
28-
import me.mrCookieSlime.Slimefun.cscorelib2.updater.GitHubBuildsUpdater;
29-
import me.mrCookieSlime.Slimefun.cscorelib2.updater.Updater;
23+
import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
24+
import io.github.thebusybiscuit.slimefun4.libraries.dough.config.Config;
25+
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack;
26+
import io.github.thebusybiscuit.slimefun4.libraries.dough.updater.GitHubBuildsUpdater;
3027

3128
public class HotbarPets extends JavaPlugin implements Listener, SlimefunAddon {
3229

33-
private Category category;
30+
private ItemGroup itemGroup;
3431

3532
@Override
3633
public void onEnable() {
@@ -39,16 +36,11 @@ public void onEnable() {
3936
// Setting up bStats
4037
new Metrics(this, 4859);
4138

42-
if (getDescription().getVersion().startsWith("DEV - ")) {
43-
Updater updater = new GitHubBuildsUpdater(this, getFile(), "TheBusyBiscuit/HotbarPets/master");
44-
45-
// Only run the Updater if it has not been disabled
46-
if (cfg.getBoolean("options.auto-update")) {
47-
updater.start();
48-
}
39+
if (cfg.getBoolean("options.auto-update") && getDescription().getVersion().startsWith("DEV - ")) {
40+
new GitHubBuildsUpdater(this, getFile(), "TheBusyBiscuit/HotbarPets/master").start();
4941
}
5042

51-
category = new Category(new NamespacedKey(this, "pets"), new CustomItem(PetTexture.CATEGORY.getAsItem(), "&dHotbar Pets", "", "&a> Click to open"));
43+
itemGroup = new ItemGroup(new NamespacedKey(this, "pets"), new CustomItemStack(PetTexture.CATEGORY.getAsItem(), "&dHotbar Pets", "", "&a> Click to open"));
5244

5345
// Add all the Pets via their Group class
5446
new FarmAnimals(this);
@@ -59,9 +51,6 @@ public void onEnable() {
5951
new UtilityPets(this);
6052
new SpecialPets(this);
6153

62-
SlimefunPlugin.getLocalization().setDefaultMessage("hotbarpets.neglected-pet", "&9Your %pet% &9would have helped you if you did not neglect it by not feeding it :(");
63-
SlimefunPlugin.getLocalization().save();
64-
6554
// Registering the Listeners
6655
new DamageListener(this);
6756
new FoodListener(this);
@@ -75,8 +64,8 @@ public void onEnable() {
7564
getServer().getScheduler().scheduleSyncRepeatingTask(this, new HotbarPetsRunnable(), 0L, 2000L);
7665
}
7766

78-
public Category getCategory() {
79-
return category;
67+
public ItemGroup getItemGroup() {
68+
return itemGroup;
8069
}
8170

8271
@Override

src/main/java/io/github/thebusybiscuit/hotbarpets/HotbarPetsRunnable.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import org.bukkit.inventory.ItemStack;
88

99
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
10-
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
10+
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
1111

1212
public class HotbarPetsRunnable implements Runnable {
1313

@@ -17,10 +17,10 @@ public class HotbarPetsRunnable implements Runnable {
1717
private final HotbarPet goldenCow;
1818

1919
protected HotbarPetsRunnable() {
20-
chicken = (HotbarPet) SlimefunItem.getByID("HOTBAR_PET_CHICKEN");
21-
mooshroom = (HotbarPet) SlimefunItem.getByID("HOTBAR_PET_MOOSHROOM");
22-
fish = (HotbarPet) SlimefunItem.getByID("HOTBAR_PET_FISH");
23-
goldenCow = (HotbarPet) SlimefunItem.getByID("HOTBAR_PET_GOLDEN_COW");
20+
chicken = (HotbarPet) SlimefunItem.getById("HOTBAR_PET_CHICKEN");
21+
mooshroom = (HotbarPet) SlimefunItem.getById("HOTBAR_PET_MOOSHROOM");
22+
fish = (HotbarPet) SlimefunItem.getById("HOTBAR_PET_FISH");
23+
goldenCow = (HotbarPet) SlimefunItem.getById("HOTBAR_PET_GOLDEN_COW");
2424
}
2525

2626
@Override

src/main/java/io/github/thebusybiscuit/hotbarpets/PetTexture.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.github.thebusybiscuit.hotbarpets;
22

3-
import me.mrCookieSlime.Slimefun.cscorelib2.skull.SkullItem;
3+
import io.github.thebusybiscuit.slimefun4.libraries.dough.skins.PlayerHead;
4+
import io.github.thebusybiscuit.slimefun4.libraries.dough.skins.PlayerSkin;
45
import org.bukkit.inventory.ItemStack;
56

67
import javax.annotation.Nonnull;
@@ -75,6 +76,6 @@ public String toString() {
7576

7677
@Nonnull
7778
public ItemStack getAsItem() {
78-
return SkullItem.fromHash(getHash());
79+
return PlayerHead.getItemStack(PlayerSkin.fromHashCode(getHash()));
7980
}
8081
}

src/main/java/io/github/thebusybiscuit/hotbarpets/SimpleBasePet.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
import org.bukkit.inventory.ItemStack;
55

66
import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler;
7-
import me.mrCookieSlime.Slimefun.Objects.Category;
8-
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
7+
import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
8+
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
99

1010
public abstract class SimpleBasePet extends HotbarPet {
1111

12-
public SimpleBasePet(Category category, SlimefunItemStack item, ItemStack food, ItemStack[] recipe) {
13-
super(category, item, food, recipe);
12+
public SimpleBasePet(ItemGroup itemGroup, SlimefunItemStack item, ItemStack food, ItemStack[] recipe) {
13+
super(itemGroup, item, food, recipe);
1414
}
1515

1616
public abstract void onUseItem(Player p);

src/main/java/io/github/thebusybiscuit/hotbarpets/groups/BossMobs.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package io.github.thebusybiscuit.hotbarpets.groups;
22

3-
import io.github.thebusybiscuit.hotbarpets.PetTexture;
43
import org.bukkit.Material;
54
import org.bukkit.inventory.ItemStack;
65

76
import io.github.thebusybiscuit.hotbarpets.HotbarPet;
87
import io.github.thebusybiscuit.hotbarpets.HotbarPets;
98
import io.github.thebusybiscuit.hotbarpets.PetGroup;
9+
import io.github.thebusybiscuit.hotbarpets.PetTexture;
1010
import io.github.thebusybiscuit.hotbarpets.pets.EnderDragonPet;
1111
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
12-
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
12+
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
1313

1414
public final class BossMobs implements PetGroup {
1515

@@ -25,13 +25,13 @@ public String getName() {
2525
@Override
2626
public void load(HotbarPets plugin) {
2727
// @formatter:off
28-
new EnderDragonPet(plugin.getCategory(), new SlimefunItemStack("HOTBAR_PET_DRAGON", Material.DRAGON_HEAD, "&5Ender Dragon Pet", getName(), "&7Favourite Food: Eyes Of Ender", "", "&fRight-Click: &7Shoots Dragon Fireball & Gives Resistance"), new ItemStack(Material.ENDER_EYE), new ItemStack[]{
28+
new EnderDragonPet(plugin.getItemGroup(), new SlimefunItemStack("HOTBAR_PET_DRAGON", Material.DRAGON_HEAD, "&5Ender Dragon Pet", getName(), "&7Favourite Food: Eyes Of Ender", "", "&fRight-Click: &7Shoots Dragon Fireball & Gives Resistance"), new ItemStack(Material.ENDER_EYE), new ItemStack[]{
2929
new ItemStack(Material.PRISMARINE_CRYSTALS), new ItemStack(Material.DRAGON_BREATH), new ItemStack(Material.PRISMARINE_CRYSTALS),
3030
SlimefunItems.ENDER_LUMP_3, new ItemStack(Material.DRAGON_HEAD), SlimefunItems.ENDER_LUMP_3,
3131
new ItemStack(Material.PRISMARINE_CRYSTALS), new ItemStack(Material.DRAGON_BREATH), new ItemStack(Material.PRISMARINE_CRYSTALS)
3232
}).register(plugin);
3333

34-
new HotbarPet(plugin.getCategory(), new SlimefunItemStack("HOTBAR_PET_WITHER", PetTexture.WITHER_PET.getHash(), "&8Wither Pet", getName(), "&7Favourite Food: Soul Sand", "", "&fImmune to Wither Effect"), new ItemStack(Material.SOUL_SAND), new ItemStack[]{
34+
new HotbarPet(plugin.getItemGroup(), new SlimefunItemStack("HOTBAR_PET_WITHER", PetTexture.WITHER_PET.getHash(), "&8Wither Pet", getName(), "&7Favourite Food: Soul Sand", "", "&fImmune to Wither Effect"), new ItemStack(Material.SOUL_SAND), new ItemStack[]{
3535
new ItemStack(Material.COAL), new ItemStack(Material.WITHER_SKELETON_SKULL), new ItemStack(Material.COAL),
3636
new ItemStack(Material.SOUL_SAND), new ItemStack(Material.NETHER_STAR), new ItemStack(Material.SOUL_SAND),
3737
new ItemStack(Material.SOUL_SAND), SlimefunItems.GOLD_24K, new ItemStack(Material.SOUL_SAND)

src/main/java/io/github/thebusybiscuit/hotbarpets/groups/FarmAnimals.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package io.github.thebusybiscuit.hotbarpets.groups;
22

3-
import io.github.thebusybiscuit.hotbarpets.PetTexture;
43
import org.bukkit.Material;
54
import org.bukkit.inventory.ItemStack;
65

76
import io.github.thebusybiscuit.hotbarpets.HotbarPet;
87
import io.github.thebusybiscuit.hotbarpets.HotbarPets;
98
import io.github.thebusybiscuit.hotbarpets.PetGroup;
9+
import io.github.thebusybiscuit.hotbarpets.PetTexture;
1010
import io.github.thebusybiscuit.hotbarpets.pets.CowPet;
1111
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
12-
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
12+
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
1313

1414
public final class FarmAnimals implements PetGroup {
1515

@@ -27,31 +27,31 @@ public void load(HotbarPets plugin) {
2727
// @formatter:off
2828
SlimefunItemStack cow = new SlimefunItemStack("HOTBAR_PET_COW", PetTexture.COW_PET.getHash(), "&6Cow Pet", getName(), "&7Favourite Food: Wheat", "", "&fRight-Click: &7Removes negative Potion Effects");
2929

30-
new HotbarPet(plugin.getCategory(), new SlimefunItemStack("HOTBAR_PET_PIG", PetTexture.PIG_PET.getHash(), "&dPig Pet", getName(), "&7Favourite Food: Carrots", "", "&fBonus Saturation when eating", "&fAllows you to eat poisonous Food"), new ItemStack(Material.CARROT), new ItemStack[] {
30+
new HotbarPet(plugin.getItemGroup(), new SlimefunItemStack("HOTBAR_PET_PIG", PetTexture.PIG_PET.getHash(), "&dPig Pet", getName(), "&7Favourite Food: Carrots", "", "&fBonus Saturation when eating", "&fAllows you to eat poisonous Food"), new ItemStack(Material.CARROT), new ItemStack[] {
3131
new ItemStack(Material.REDSTONE), new ItemStack(Material.CARROT), new ItemStack(Material.REDSTONE),
3232
new ItemStack(Material.PORKCHOP), new ItemStack(Material.DIAMOND), new ItemStack(Material.PORKCHOP),
3333
new ItemStack(Material.REDSTONE), SlimefunItems.GOLD_16K, new ItemStack(Material.REDSTONE)
3434
}).register(plugin);
3535

36-
new HotbarPet(plugin.getCategory(), new SlimefunItemStack("HOTBAR_PET_CHICKEN", PetTexture.CHICKEN_PET.getHash(), "&fChicken Pet", getName(), "&7Favourite Food: Seeds", "", "&fGives you Eggs over time..."), new ItemStack(Material.WHEAT_SEEDS), new ItemStack[] {
36+
new HotbarPet(plugin.getItemGroup(), new SlimefunItemStack("HOTBAR_PET_CHICKEN", PetTexture.CHICKEN_PET.getHash(), "&fChicken Pet", getName(), "&7Favourite Food: Seeds", "", "&fGives you Eggs over time..."), new ItemStack(Material.WHEAT_SEEDS), new ItemStack[] {
3737
new ItemStack(Material.REDSTONE), new ItemStack(Material.FEATHER), new ItemStack(Material.REDSTONE),
3838
new ItemStack(Material.COOKED_CHICKEN), new ItemStack(Material.DIAMOND), new ItemStack(Material.COOKED_CHICKEN),
3939
new ItemStack(Material.REDSTONE), SlimefunItems.GOLD_16K, new ItemStack(Material.REDSTONE)
4040
}).register(plugin);
4141

42-
new HotbarPet(plugin.getCategory(), new SlimefunItemStack("HOTBAR_PET_MOOSHROOM", PetTexture.MOOSHROOM_PET.getHash(), "&dMooshroom Pet", getName(), "&7Favourite Food: Red Mushrooms", "", "&fGives you Mushroom Stew over time..."), new ItemStack(Material.RED_MUSHROOM), new ItemStack[] {
42+
new HotbarPet(plugin.getItemGroup(), new SlimefunItemStack("HOTBAR_PET_MOOSHROOM", PetTexture.MOOSHROOM_PET.getHash(), "&dMooshroom Pet", getName(), "&7Favourite Food: Red Mushrooms", "", "&fGives you Mushroom Stew over time..."), new ItemStack(Material.RED_MUSHROOM), new ItemStack[] {
4343
new ItemStack(Material.LAPIS_LAZULI), new ItemStack(Material.COOKED_BEEF), new ItemStack(Material.LAPIS_LAZULI),
4444
new ItemStack(Material.RED_MUSHROOM), new ItemStack(Material.DIAMOND), new ItemStack(Material.BROWN_MUSHROOM),
4545
new ItemStack(Material.LAPIS_LAZULI), SlimefunItems.GOLD_16K, new ItemStack(Material.LAPIS_LAZULI)
4646
}).register(plugin);
4747

48-
new CowPet(plugin.getCategory(), cow, new ItemStack(Material.WHEAT), new ItemStack[] {
48+
new CowPet(plugin.getItemGroup(), cow, new ItemStack(Material.WHEAT), new ItemStack[] {
4949
new ItemStack(Material.COAL), new ItemStack(Material.WHEAT), new ItemStack(Material.COAL),
5050
new ItemStack(Material.COOKED_BEEF), new ItemStack(Material.DIAMOND), new ItemStack(Material.COOKED_BEEF),
5151
new ItemStack(Material.COAL), SlimefunItems.GOLD_16K, new ItemStack(Material.COAL)
5252
}).register(plugin);
5353

54-
new HotbarPet(plugin.getCategory(), new SlimefunItemStack("HOTBAR_PET_GOLDEN_COW", PetTexture.GOLDEN_COW_PET.getHash(), "&6Golden Cow Pet", getName(), "&7Favourite Food: Golden Carrots", "", "&fGives you Golden Ingots over time...", "&f(That means you have a net gain of 1 golden nugget)"), new ItemStack(Material.GOLDEN_CARROT), new ItemStack[] {
54+
new HotbarPet(plugin.getItemGroup(), new SlimefunItemStack("HOTBAR_PET_GOLDEN_COW", PetTexture.GOLDEN_COW_PET.getHash(), "&6Golden Cow Pet", getName(), "&7Favourite Food: Golden Carrots", "", "&fGives you Golden Ingots over time...", "&f(That means you have a net gain of 1 golden nugget)"), new ItemStack(Material.GOLDEN_CARROT), new ItemStack[] {
5555
new ItemStack(Material.GOLDEN_CARROT), new ItemStack(Material.GOLD_NUGGET), new ItemStack(Material.GOLDEN_CARROT),
5656
new ItemStack(Material.GOLD_NUGGET), cow, new ItemStack(Material.GOLD_NUGGET),
5757
new ItemStack(Material.GOLDEN_CARROT), new ItemStack(Material.GOLD_NUGGET), new ItemStack(Material.GOLDEN_CARROT)

0 commit comments

Comments
 (0)