1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Changed requested changes

This commit is contained in:
Panda.com 2020-03-01 14:27:11 +01:00
parent cbd7faf4d7
commit 105b32583d
2 changed files with 26 additions and 19 deletions

View File

@ -72,7 +72,7 @@ abstract class ScriptHolder extends SimpleSlimefunItem<BlockTicker> {
public void openScript(Player p, Block b, String script) { public void openScript(Player p, Block b, String script) {
ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocal().getMessage(p, "android.scripts.editor")); ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocal().getMessage(p, "android.scripts.editor"));
String[] commands = PatternUtils.SLASH_SEPARATOR.split(script); String[] commands = PatternUtils.DASH.split(script);
menu.addItem(0, new CustomItem(ScriptPart.START.getItem(), SlimefunPlugin.getLocal().getMessage(p, "android.scripts.instructions.START"), "", "&7\u21E8 &eLeft Click &7to return to the Android's interface")); menu.addItem(0, new CustomItem(ScriptPart.START.getItem(), SlimefunPlugin.getLocal().getMessage(p, "android.scripts.instructions.START"), "", "&7\u21E8 &eLeft Click &7to return to the Android's interface"));
menu.addMenuClickHandler(0, (pl, slot, item, action) -> { menu.addMenuClickHandler(0, (pl, slot, item, action) -> {
@ -392,7 +392,7 @@ abstract class ScriptHolder extends SimpleSlimefunItem<BlockTicker> {
protected void openScriptComponentEditor(Player p, Block b, String script, int index) { protected void openScriptComponentEditor(Player p, Block b, String script, int index) {
ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocal().getMessage(p, "android.scripts.editor")); ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocal().getMessage(p, "android.scripts.editor"));
String[] commands = PatternUtils.SLASH_SEPARATOR.split(script); String[] commands = PatternUtils.DASH.split(script);
ChestMenuUtils.drawBackground(menu, 0, 1, 2, 3, 4, 5, 6, 7, 8); ChestMenuUtils.drawBackground(menu, 0, 1, 2, 3, 4, 5, 6, 7, 8);

View File

@ -29,6 +29,19 @@ public class GearListener implements Listener {
if (p.getInventory().getChestplate() != null) { if (p.getInventory().getChestplate() != null) {
SlimefunItem chestplate = SlimefunItem.getByItem(p.getInventory().getChestplate()); SlimefunItem chestplate = SlimefunItem.getByItem(p.getInventory().getChestplate());
handleChestplate(p, chestplate);
}
if (p.getInventory().getBoots() != null) {
SlimefunItem boots = SlimefunItem.getByItem(p.getInventory().getBoots());
handleBoots(p, boots);
}
if (SlimefunManager.containsSimilarItem(p.getInventory(), SlimefunItems.INFUSED_MAGNET, true))
new MagnetTask(p).scheduleRepeating(0, 8);
}
private void handleChestplate(Player p, SlimefunItem chestplate) {
if (chestplate == null || !Slimefun.hasUnlocked(p, chestplate, true)) return; if (chestplate == null || !Slimefun.hasUnlocked(p, chestplate, true)) return;
if (chestplate instanceof Jetpack) { if (chestplate instanceof Jetpack) {
@ -40,9 +53,7 @@ public class GearListener implements Listener {
new ParachuteTask(p).scheduleRepeating(0, 3); new ParachuteTask(p).scheduleRepeating(0, 3);
} }
if (p.getInventory().getBoots() != null) { private void handleBoots(Player p, SlimefunItem boots) {
SlimefunItem boots = SlimefunItem.getByItem(p.getInventory().getBoots());
if (boots instanceof JetBoots && Slimefun.hasUnlocked(p, boots, true)) { if (boots instanceof JetBoots && Slimefun.hasUnlocked(p, boots, true)) {
double speed = ((JetBoots) boots).getSpeed(); double speed = ((JetBoots) boots).getSpeed();
@ -50,8 +61,4 @@ public class GearListener implements Listener {
new JetBootsTask(p, speed).scheduleRepeating(0, 2); new JetBootsTask(p, speed).scheduleRepeating(0, 2);
} }
} }
if (SlimefunManager.containsSimilarItem(p.getInventory(), SlimefunItems.INFUSED_MAGNET, true))
new MagnetTask(p).scheduleRepeating(0, 8);
}
} }