mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fixes #2217
This commit is contained in:
parent
923b59c6e7
commit
c0d18c5c89
@ -59,6 +59,7 @@
|
|||||||
* Fixed #2203
|
* Fixed #2203
|
||||||
* Fixed #2205
|
* Fixed #2205
|
||||||
* Fixed #2209
|
* Fixed #2209
|
||||||
|
* Fixed #2217
|
||||||
|
|
||||||
## Release Candidate 15 (01 Aug 2020)
|
## Release Candidate 15 (01 Aug 2020)
|
||||||
|
|
||||||
|
@ -21,6 +21,12 @@ import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
|
|||||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This menu shows a list of every {@link Contributor} to this project.
|
||||||
|
*
|
||||||
|
* @author TheBusyBiscuit
|
||||||
|
*
|
||||||
|
*/
|
||||||
final class ContributorsMenu {
|
final class ContributorsMenu {
|
||||||
|
|
||||||
private ContributorsMenu() {}
|
private ContributorsMenu() {}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package io.github.thebusybiscuit.slimefun4.core.guide.options;
|
package io.github.thebusybiscuit.slimefun4.core.guide.options;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -8,6 +10,7 @@ import org.bukkit.Sound;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
||||||
import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
|
import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
|
||||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||||
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
|
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
|
||||||
@ -16,6 +19,7 @@ import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
|
|||||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||||
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
||||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
|
||||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||||
|
|
||||||
@ -37,7 +41,16 @@ class PlayerLanguageOption implements SlimefunGuideOption<String> {
|
|||||||
Language language = SlimefunPlugin.getLocalization().getLanguage(p);
|
Language language = SlimefunPlugin.getLocalization().getLanguage(p);
|
||||||
String languageName = language.isDefault() ? (SlimefunPlugin.getLocalization().getMessage(p, "languages.default") + ChatColor.DARK_GRAY + " (" + language.getName(p) + ")") : SlimefunPlugin.getLocalization().getMessage(p, "languages." + language.getId());
|
String languageName = language.isDefault() ? (SlimefunPlugin.getLocalization().getMessage(p, "languages.default") + ChatColor.DARK_GRAY + " (" + language.getName(p) + ")") : SlimefunPlugin.getLocalization().getMessage(p, "languages." + language.getId());
|
||||||
|
|
||||||
return Optional.of(new CustomItem(language.getItem(), "&7" + SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.selected-language") + " &a" + languageName, "", "&7You now have the option to change", "&7the language in which Slimefun", "&7will send you messages.", "&7Note that this only translates", "&7some messages, not items.", "&7&oThis feature is still being worked on", "", "&7\u21E8 &eClick to change your language"));
|
List<String> lore = new ArrayList<>();
|
||||||
|
lore.add("");
|
||||||
|
lore.add(ChatColors.color("&e&o") + SlimefunPlugin.getLocalization().getMessage(p, "guide.work-in-progress"));
|
||||||
|
lore.add("");
|
||||||
|
lore.addAll(SlimefunPlugin.getLocalization().getMessages(p, "guide.languages.description"));
|
||||||
|
lore.add("");
|
||||||
|
lore.add("&7\u21E8 &e" + SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.change"));
|
||||||
|
|
||||||
|
ItemStack item = new CustomItem(language.getItem(), "&7" + SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.selected-language") + " &a" + languageName, lore.toArray(new String[0]));
|
||||||
|
return Optional.of(item);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
@ -78,7 +91,7 @@ class PlayerLanguageOption implements SlimefunGuideOption<String> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (i == 7) {
|
else if (i == 7) {
|
||||||
menu.addItem(7, new CustomItem(SlimefunUtils.getCustomHead("3edd20be93520949e6ce789dc4f43efaeb28c717ee6bfcbbe02780142f716"), SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.translations.name"), "", "&7\u21E8 &e" + SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.translations.lore")), (pl, slot, item, action) -> {
|
menu.addItem(7, new CustomItem(SlimefunUtils.getCustomHead(HeadTexture.ADD_NEW_LANGUAGE.getTexture()), SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.translations.name"), "", "&7\u21E8 &e" + SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.translations.lore")), (pl, slot, item, action) -> {
|
||||||
ChatUtils.sendURL(pl, "https://github.com/TheBusyBiscuit/Slimefun4/wiki/Translating-Slimefun");
|
ChatUtils.sendURL(pl, "https://github.com/TheBusyBiscuit/Slimefun4/wiki/Translating-Slimefun");
|
||||||
pl.closeInventory();
|
pl.closeInventory();
|
||||||
return false;
|
return false;
|
||||||
|
@ -21,6 +21,7 @@ import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
|||||||
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
|
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
|
||||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||||
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This static utility class offers various methods that provide access to the
|
* This static utility class offers various methods that provide access to the
|
||||||
@ -78,7 +79,7 @@ public final class SlimefunGuideSettings {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
menu.addItem(4, new CustomItem(Material.WRITABLE_BOOK, "&aSlimefun Version", "&7&o" + SlimefunPlugin.getLocalization().getMessage(p, "guide.tooltips.versions-notice"), "", "&fMinecraft Version: &a" + Bukkit.getBukkitVersion(), "&fSlimefun Version: &a" + SlimefunPlugin.getVersion(), "&fCS-CoreLib Version: &a" + SlimefunPlugin.getCSCoreLibVersion()), ChestMenuUtils.getEmptyClickHandler());
|
menu.addItem(4, new CustomItem(Material.WRITABLE_BOOK, "&aSlimefun Version", "&7&o" + SlimefunPlugin.getLocalization().getMessage(p, "guide.tooltips.versions-notice"), "", "&fMinecraft: &a" + Bukkit.getBukkitVersion(), "&fSlimefun: &a" + SlimefunPlugin.getVersion(), "&fCS-CoreLib: &a" + SlimefunPlugin.getCSCoreLibVersion()), ChestMenuUtils.getEmptyClickHandler());
|
||||||
|
|
||||||
menu.addItem(6, new CustomItem(Material.COMPARATOR, "&e" + SlimefunPlugin.getLocalization().getMessage(p, "guide.title.source"), "", "&7Last Activity: &a" + NumberUtils.getElapsedTime(SlimefunPlugin.getGitHubService().getLastUpdate()) + " ago", "&7Forks: &e" + SlimefunPlugin.getGitHubService().getForks(), "&7Stars: &e" + SlimefunPlugin.getGitHubService().getStars(), "", "&7&oSlimefun 4 is a community project,", "&7&othe source code is available on GitHub", "&7&oand if you want to keep this Plugin alive,", "&7&othen please consider contributing to it", "", "&7\u21E8 &eClick to go to GitHub"));
|
menu.addItem(6, new CustomItem(Material.COMPARATOR, "&e" + SlimefunPlugin.getLocalization().getMessage(p, "guide.title.source"), "", "&7Last Activity: &a" + NumberUtils.getElapsedTime(SlimefunPlugin.getGitHubService().getLastUpdate()) + " ago", "&7Forks: &e" + SlimefunPlugin.getGitHubService().getForks(), "&7Stars: &e" + SlimefunPlugin.getGitHubService().getStars(), "", "&7&oSlimefun 4 is a community project,", "&7&othe source code is available on GitHub", "&7&oand if you want to keep this Plugin alive,", "&7&othen please consider contributing to it", "", "&7\u21E8 &eClick to go to GitHub"));
|
||||||
menu.addMenuClickHandler(6, (pl, slot, item, action) -> {
|
menu.addMenuClickHandler(6, (pl, slot, item, action) -> {
|
||||||
@ -110,7 +111,7 @@ public final class SlimefunGuideSettings {
|
|||||||
menu.addItem(49, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
|
menu.addItem(49, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.addItem(51, new CustomItem(Material.TOTEM_OF_UNDYING, "&cSoon", "", "&7Something will be added here later..."), (pl, slot, item, action) -> {
|
menu.addItem(51, new CustomItem(Material.TOTEM_OF_UNDYING, ChatColor.RED + SlimefunPlugin.getLocalization().getMessage(p, "guide.work-in-progress")), (pl, slot, item, action) -> {
|
||||||
// Add something here
|
// Add something here
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -3,10 +3,12 @@ package io.github.thebusybiscuit.slimefun4.core.handlers;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem;
|
import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.EntityInteractionListener;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
|
import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
|
||||||
|
|
||||||
@ -15,9 +17,9 @@ import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
|
|||||||
*
|
*
|
||||||
* @author Linox
|
* @author Linox
|
||||||
*
|
*
|
||||||
|
* @see EntityInteractionListener
|
||||||
* @see ItemHandler
|
* @see ItemHandler
|
||||||
* @see SimpleSlimefunItem
|
* @see SimpleSlimefunItem
|
||||||
* @see PlayerInteractAtEntityEvent
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
@ -27,16 +29,14 @@ public interface EntityInteractHandler extends ItemHandler {
|
|||||||
* This function is triggered when a {@link Player} right clicks with the assigned {@link SlimefunItem}
|
* This function is triggered when a {@link Player} right clicks with the assigned {@link SlimefunItem}
|
||||||
* in his hand.
|
* in his hand.
|
||||||
*
|
*
|
||||||
* @param p
|
* @param e
|
||||||
* The {@link Player} that right clicked
|
* The {@link PlayerInteractAtEntityEvent} which was called
|
||||||
* @param entity
|
|
||||||
* The {@link Entity} that was right clicked on
|
|
||||||
* @param item
|
* @param item
|
||||||
* The {@link ItemStack} that was held and used while triggering
|
* The {@link ItemStack} that was held and used while triggering
|
||||||
* @param offHand
|
* @param offHand
|
||||||
* <code>true</code> if the {@link EquipmentSlot} is off hand
|
* <code>true</code> if the {@link EquipmentSlot} is off hand
|
||||||
*/
|
*/
|
||||||
void onInteract(Player p, Entity entity, ItemStack item, boolean offHand);
|
void onInteract(PlayerInteractEntityEvent e, ItemStack item, boolean offHand);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default Class<? extends ItemHandler> getIdentifier() {
|
default Class<? extends ItemHandler> getIdentifier() {
|
||||||
|
@ -70,7 +70,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.ItemPickupLis
|
|||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.MobDropListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.MobDropListener;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.MultiBlockListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.MultiBlockListener;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.PiglinListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.PiglinListener;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.PlayerInteractEntityListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.EntityInteractionListener;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.PlayerProfileListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.PlayerProfileListener;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SeismicAxeListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SeismicAxeListener;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBootsListener;
|
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBootsListener;
|
||||||
@ -441,7 +441,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
|||||||
new FireworksListener(this);
|
new FireworksListener(this);
|
||||||
new WitherListener(this);
|
new WitherListener(this);
|
||||||
new IronGolemListener(this);
|
new IronGolemListener(this);
|
||||||
new PlayerInteractEntityListener(this);
|
new EntityInteractionListener(this);
|
||||||
new MobDropListener(this);
|
new MobDropListener(this);
|
||||||
new VillagerTradingListener(this);
|
new VillagerTradingListener(this);
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import io.github.thebusybiscuit.slimefun4.core.attributes.Rechargeable;
|
import io.github.thebusybiscuit.slimefun4.core.attributes.Rechargeable;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.core.handlers.EntityInteractHandler;
|
||||||
import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler;
|
import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler;
|
||||||
import io.github.thebusybiscuit.slimefun4.core.handlers.ToolUseHandler;
|
import io.github.thebusybiscuit.slimefun4.core.handlers.ToolUseHandler;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||||
@ -42,6 +43,21 @@ public class MultiTool extends SlimefunItem implements Rechargeable {
|
|||||||
return capacity;
|
return capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int nextIndex(int i) {
|
||||||
|
int index = i;
|
||||||
|
|
||||||
|
do {
|
||||||
|
index++;
|
||||||
|
|
||||||
|
if (index >= modes.size()) {
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (index != i && !modes.get(index).isEnabled());
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
protected ItemUseHandler getItemUseHandler() {
|
protected ItemUseHandler getItemUseHandler() {
|
||||||
return e -> {
|
return e -> {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
@ -64,29 +80,33 @@ public class MultiTool extends SlimefunItem implements Rechargeable {
|
|||||||
|
|
||||||
SlimefunItem selectedItem = modes.get(index).getItem();
|
SlimefunItem selectedItem = modes.get(index).getItem();
|
||||||
String itemName = selectedItem != null ? selectedItem.getItemName() : "Unknown";
|
String itemName = selectedItem != null ? selectedItem.getItemName() : "Unknown";
|
||||||
SlimefunPlugin.getLocalization().sendMessage(p, "messages.mode-change", true, msg -> msg.replace("%device%", "Multi Tool").replace("%mode%", ChatColor.stripColor(itemName)));
|
SlimefunPlugin.getLocalization().sendMessage(p, "messages.multi-tool.mode-change", true, msg -> msg.replace("%device%", "Multi Tool").replace("%mode%", ChatColor.stripColor(itemName)));
|
||||||
selectedMode.put(p.getUniqueId(), index);
|
selectedMode.put(p.getUniqueId(), index);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private int nextIndex(int i) {
|
private ToolUseHandler getToolUseHandler() {
|
||||||
int index = i;
|
return (e, tool, fortune, drops) -> {
|
||||||
|
SlimefunPlugin.getLocalization().sendMessage(e.getPlayer(), "messages.multi-tool.not-shears");
|
||||||
do {
|
e.setCancelled(true);
|
||||||
index++;
|
};
|
||||||
|
|
||||||
if (index >= modes.size()) {
|
|
||||||
index = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (index != i && !modes.get(index).isEnabled());
|
|
||||||
|
|
||||||
return index;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ToolUseHandler getToolUseHandler() {
|
private EntityInteractHandler getEntityInteractionHandler() {
|
||||||
return (e, tool, fortune, drops) -> e.setCancelled(true);
|
return (e, item, offhand) -> {
|
||||||
|
// Fixes #2217 - Prevent them from being used to shear entities
|
||||||
|
switch (e.getRightClicked().getType()) {
|
||||||
|
case MUSHROOM_COW:
|
||||||
|
case SHEEP:
|
||||||
|
case SNOWMAN:
|
||||||
|
SlimefunPlugin.getLocalization().sendMessage(e.getPlayer(), "messages.multi-tool.not-shears");
|
||||||
|
e.setCancelled(true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -95,6 +115,7 @@ public class MultiTool extends SlimefunItem implements Rechargeable {
|
|||||||
|
|
||||||
addItemHandler(getItemUseHandler());
|
addItemHandler(getItemUseHandler());
|
||||||
addItemHandler(getToolUseHandler());
|
addItemHandler(getToolUseHandler());
|
||||||
|
addItemHandler(getEntityInteractionHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
package io.github.thebusybiscuit.slimefun4.implementation.items.magical;
|
package io.github.thebusybiscuit.slimefun4.implementation.items.magical;
|
||||||
|
|
||||||
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
|
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Villager;
|
import org.bukkit.entity.Villager;
|
||||||
import org.bukkit.entity.ZombieVillager;
|
import org.bukkit.entity.ZombieVillager;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
|
||||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||||
import io.github.thebusybiscuit.slimefun4.core.handlers.EntityInteractHandler;
|
import io.github.thebusybiscuit.slimefun4.core.handlers.EntityInteractHandler;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||||
@ -38,8 +39,11 @@ public class MagicalZombiePills extends SimpleSlimefunItem<EntityInteractHandler
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityInteractHandler getItemHandler() {
|
public EntityInteractHandler getItemHandler() {
|
||||||
return (p, entity, item, offhand) -> {
|
return (e, item, offhand) -> {
|
||||||
|
Entity entity = e.getRightClicked();
|
||||||
|
|
||||||
if (entity.getType() == EntityType.ZOMBIE_VILLAGER) {
|
if (entity.getType() == EntityType.ZOMBIE_VILLAGER) {
|
||||||
|
Player p = e.getPlayer();
|
||||||
|
|
||||||
if (p.getGameMode() != GameMode.CREATIVE) {
|
if (p.getGameMode() != GameMode.CREATIVE) {
|
||||||
ItemUtils.consumeItem(item, false);
|
ItemUtils.consumeItem(item, false);
|
||||||
|
@ -4,7 +4,7 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -21,14 +21,14 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
|
|||||||
* @see EntityInteractHandler
|
* @see EntityInteractHandler
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class PlayerInteractEntityListener implements Listener {
|
public class EntityInteractionListener implements Listener {
|
||||||
|
|
||||||
public PlayerInteractEntityListener(SlimefunPlugin plugin) {
|
public EntityInteractionListener(SlimefunPlugin plugin) {
|
||||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInteractEntity(PlayerInteractAtEntityEvent e) {
|
public void onInteractEntity(PlayerInteractEntityEvent e) {
|
||||||
if (!e.getRightClicked().isValid()) {
|
if (!e.getRightClicked().isValid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ public class PlayerInteractEntityListener implements Listener {
|
|||||||
SlimefunItem sfItem = SlimefunItem.getByItem(itemStack);
|
SlimefunItem sfItem = SlimefunItem.getByItem(itemStack);
|
||||||
|
|
||||||
if (sfItem != null && Slimefun.hasUnlocked(e.getPlayer(), sfItem, true)) {
|
if (sfItem != null && Slimefun.hasUnlocked(e.getPlayer(), sfItem, true)) {
|
||||||
sfItem.callItemHandler(EntityInteractHandler.class, handler -> handler.onInteract(e.getPlayer(), e.getRightClicked(), itemStack, e.getHand() == EquipmentSlot.OFF_HAND));
|
sfItem.callItemHandler(EntityInteractHandler.class, handler -> handler.onInteract(e, itemStack, e.getHand() == EquipmentSlot.OFF_HAND));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -181,6 +181,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.IcyBow;
|
|||||||
import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.SeismicAxe;
|
import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.SeismicAxe;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.SwordOfBeheading;
|
import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.SwordOfBeheading;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.VampireBlade;
|
import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.VampireBlade;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
|
||||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||||
@ -384,7 +385,7 @@ public final class SlimefunItemSetup {
|
|||||||
.register(plugin);
|
.register(plugin);
|
||||||
|
|
||||||
new BasicCircuitBoard(categories.technicalComponents, SlimefunItems.BASIC_CIRCUIT_BOARD, RecipeType.MOB_DROP,
|
new BasicCircuitBoard(categories.technicalComponents, SlimefunItems.BASIC_CIRCUIT_BOARD, RecipeType.MOB_DROP,
|
||||||
new ItemStack[] {null, null, null, null, new CustomItem(SlimefunUtils.getCustomHead("89091d79ea0f59ef7ef94d7bba6e5f17f2f7d4572c44f90f76c4819a714"), "&aIron Golem"), null, null, null, null})
|
new ItemStack[] {null, null, null, null, new CustomItem(SlimefunUtils.getCustomHead(HeadTexture.IRON_GOLEM.getTexture()), "&aIron Golem"), null, null, null, null})
|
||||||
.register(plugin);
|
.register(plugin);
|
||||||
|
|
||||||
new UnplaceableBlock(categories.technicalComponents, SlimefunItems.ADVANCED_CIRCUIT_BOARD, RecipeType.ENHANCED_CRAFTING_TABLE,
|
new UnplaceableBlock(categories.technicalComponents, SlimefunItems.ADVANCED_CIRCUIT_BOARD, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||||
|
@ -99,7 +99,9 @@ public enum HeadTexture {
|
|||||||
MINECRAFT_CHUNK("8449b9318e33158e64a46ab0de121c3d40000e3332c1574932b3c849d8fa0dc2"),
|
MINECRAFT_CHUNK("8449b9318e33158e64a46ab0de121c3d40000e3332c1574932b3c849d8fa0dc2"),
|
||||||
CHEST_TERMINAL("7a44ff3a5f49c69cab676bad8d98a063fa78cfa61916fdef3e267557fec18283"),
|
CHEST_TERMINAL("7a44ff3a5f49c69cab676bad8d98a063fa78cfa61916fdef3e267557fec18283"),
|
||||||
CARGO_ARROW_LEFT("f2599bd986659b8ce2c4988525c94e19ddd39fad08a38284a197f1b70675acc"),
|
CARGO_ARROW_LEFT("f2599bd986659b8ce2c4988525c94e19ddd39fad08a38284a197f1b70675acc"),
|
||||||
CARGO_ARROW_RIGHT("c2f910c47da042e4aa28af6cc81cf48ac6caf37dab35f88db993accb9dfe516");
|
CARGO_ARROW_RIGHT("c2f910c47da042e4aa28af6cc81cf48ac6caf37dab35f88db993accb9dfe516"),
|
||||||
|
ADD_NEW_LANGUAGE("3edd20be93520949e6ce789dc4f43efaeb28c717ee6bfcbbe02780142f716"),
|
||||||
|
IRON_GOLEM("89091d79ea0f59ef7ef94d7bba6e5f17f2f7d4572c44f90f76c4819a714");
|
||||||
|
|
||||||
private final String texture;
|
private final String texture;
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ commands:
|
|||||||
|
|
||||||
guide:
|
guide:
|
||||||
locked: 'LOCKED'
|
locked: 'LOCKED'
|
||||||
|
work-in-progress: 'This feature is not fully finished yet!'
|
||||||
|
|
||||||
locked-category:
|
locked-category:
|
||||||
- 'To unlock this category you will'
|
- 'To unlock this category you will'
|
||||||
@ -64,6 +65,13 @@ guide:
|
|||||||
selected-language: 'Currently selected:'
|
selected-language: 'Currently selected:'
|
||||||
select: 'Click to select this language'
|
select: 'Click to select this language'
|
||||||
select-default: 'Click to select the default language'
|
select-default: 'Click to select the default language'
|
||||||
|
change: 'Click to select a new language'
|
||||||
|
|
||||||
|
description:
|
||||||
|
- '&7You now have the option to change'
|
||||||
|
- '&7the language in which Slimefun'
|
||||||
|
- '&7will be presented to you. Items'
|
||||||
|
- '&7cannot be translated for now.'
|
||||||
|
|
||||||
translations:
|
translations:
|
||||||
name: '&aIs something missing?'
|
name: '&aIs something missing?'
|
||||||
@ -83,6 +91,7 @@ guide:
|
|||||||
commit: 'Commit'
|
commit: 'Commit'
|
||||||
commits: 'Commits'
|
commits: 'Commits'
|
||||||
profile-link: 'Click to visit their profile on GitHub'
|
profile-link: 'Click to visit their profile on GitHub'
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
developer: '&6Developer'
|
developer: '&6Developer'
|
||||||
wiki: '&3Wiki Editor'
|
wiki: '&3Wiki Editor'
|
||||||
@ -105,13 +114,16 @@ messages:
|
|||||||
not-valid-research: '&4%research% &cis not a valid Research!'
|
not-valid-research: '&4%research% &cis not a valid Research!'
|
||||||
give-research: '&bYou have given %player% the Research &7"%research%&7"'
|
give-research: '&bYou have given %player% the Research &7"%research%&7"'
|
||||||
hungry: '&cYou are too hungry to do that!'
|
hungry: '&cYou are too hungry to do that!'
|
||||||
mode-change: '&b%device% mode changed to: &9%mode%'
|
|
||||||
disabled-in-world: '&4&lThis Item has been disabled in this world'
|
disabled-in-world: '&4&lThis Item has been disabled in this world'
|
||||||
disabled-item: '&4&lThis Item has been disabled! How did you even get that?'
|
disabled-item: '&4&lThis Item has been disabled! How did you even get that?'
|
||||||
no-tome-yourself: '&cYou cannot use the &4Tome of Knowledge &con yourself...'
|
no-tome-yourself: '&cYou cannot use the &4Tome of Knowledge &con yourself...'
|
||||||
multimeter: '&bStored Energy: &3%stored% &b/ &3%capacity%'
|
multimeter: '&bStored Energy: &3%stored% &b/ &3%capacity%'
|
||||||
piglin-barter: '&4You cannot barter with piglins using Slimefun items'
|
piglin-barter: '&4You cannot barter with piglins using Slimefun items'
|
||||||
|
|
||||||
|
multi-tool:
|
||||||
|
mode-change: '&b%device% mode changed to: &9%mode%'
|
||||||
|
not-shears: '&cA Multi Tool cannot be used as shears!'
|
||||||
|
|
||||||
talisman:
|
talisman:
|
||||||
anvil: '&a&oYour Talisman saved your tool from breaking'
|
anvil: '&a&oYour Talisman saved your tool from breaking'
|
||||||
miner: '&a&oYour Talisman just doubled your drops'
|
miner: '&a&oYour Talisman just doubled your drops'
|
||||||
|
Loading…
Reference in New Issue
Block a user