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) {
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.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) {
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);

View File

@ -25,33 +25,40 @@ public class GearListener implements Listener {
@EventHandler
public void onToggleSneak(PlayerToggleSneakEvent e) {
if (!e.isSneaking()) return;
Player p = e.getPlayer();
Player p = e.getPlayer();
if (p.getInventory().getChestplate() != null) {
SlimefunItem chestplate = SlimefunItem.getByItem(p.getInventory().getChestplate());
if (chestplate == null || !Slimefun.hasUnlocked(p, chestplate, true)) return;
if (chestplate instanceof Jetpack) {
double thrust = ((Jetpack) chestplate).getThrust();
if (thrust > 0.2)
new JetpackTask(p, thrust).scheduleRepeating(0, 3);
} else if (chestplate.getID().equals("PARACHUTE"))
new ParachuteTask(p).scheduleRepeating(0, 3);
handleChestplate(p, chestplate);
}
if (p.getInventory().getBoots() != null) {
SlimefunItem boots = SlimefunItem.getByItem(p.getInventory().getBoots());
if (boots instanceof JetBoots && Slimefun.hasUnlocked(p, boots, true)) {
double speed = ((JetBoots) boots).getSpeed();
if (speed > 0.2)
new JetBootsTask(p, speed).scheduleRepeating(0, 2);
}
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 instanceof Jetpack) {
double thrust = ((Jetpack) chestplate).getThrust();
if (thrust > 0.2)
new JetpackTask(p, thrust).scheduleRepeating(0, 3);
} else if (chestplate.getID().equals("PARACHUTE"))
new ParachuteTask(p).scheduleRepeating(0, 3);
}
private void handleBoots(Player p, SlimefunItem boots) {
if (boots instanceof JetBoots && Slimefun.hasUnlocked(p, boots, true)) {
double speed = ((JetBoots) boots).getSpeed();
if (speed > 0.2)
new JetBootsTask(p, speed).scheduleRepeating(0, 2);
}
}
}