Fixed multiple libs, Added more information to toggle menu.

This commit is contained in:
Lesley Dom committed 2020-09-14 13:09:17 +02:00
1 parent a6ac5962d5
commit 826448f29c
3 files changed
+25 -21

No files matched your search

@@ -58,10 +58,10 @@ public class PlayerMoveListener implements Listener {
}
Double speed = e.getFrom().clone().add(0, -e.getFrom().getY(), 0).distance(e.getTo().clone().add(0, -e.getTo().getY(), 0));
if (Math.abs(e.getFrom().getYaw() - e.getTo().getYaw()) > 5) {
if (Math.abs(e.getFrom().getYaw() - e.getTo().getYaw()) > 2.5) {
return;
}
if (Math.abs(e.getFrom().getPitch() - e.getTo().getPitch()) > 5) {
if (Math.abs(e.getFrom().getPitch() - e.getTo().getPitch()) > 2.5) {
return;
}
if (lastVelocity.containsKey(e.getPlayer().getName())) {
@@ -41,13 +41,21 @@ import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class UtilitiesMenuProvider implements InventoryProvider {
private static final ItemStack ENABLED = new ItemStack(Material.GREEN_STAINED_GLASS_PANE);
private static final ItemStack DISABLED = new ItemStack(Material.RED_STAINED_GLASS_PANE);
private static final ItemStack NO_PERMISSION = new ItemStack(Material.ORANGE_STAINED_GLASS_PANE);
private static final ItemStack ENABLED = Items.create(Material.GREEN_STAINED_GLASS_PANE, "&c", "");
private static final ItemStack DISABLED = Items.create(Material.RED_STAINED_GLASS_PANE, "&c", "");
private static final ItemStack NO_PERMISSION = Items.create(Material.ORANGE_STAINED_GLASS_PANE, "&c", "");
private static final String ENABLED_LORE = "&a&lEnabled__&7__&7Click to toggle";
private static final String DISABLED_LORE = "&c&lDisabled__&7__&7Click to toggle";
private static final String IRON_TRAPDOOR_LORE = "__&c__&8&oActs like wooden trapdoors";
private static final String SLAB_BREAKING_LORE = "__&c__&8&oHold any slab to break double slab blocks";
private static final String GLAZED_ROTATING_LORE = "__&c__&8&oShift right click with emtpy hand";
private static final String NIGHT_VISION_LORE = "__&c__&8&oSee in the dark";
private static final String NO_CLIP_LORE = "__&c__&8&oFly through blocks with ease";
private static final String ADVANCED_FLY_LORE = "__&c__&8&oRemoves velocity when you stop flying";
@Override
public void init(Player player, InventoryContents contents) {
setIronTrapdoorItem(player, contents);
@@ -69,7 +77,7 @@ public class UtilitiesMenuProvider implements InventoryProvider {
if (!IronTrapdoorListener.ironTrapdoorIds.contains(player.getUniqueId())) {
setEnabledGlassPanes(1, true, contents);
contents.set(1, 1, ClickableItem.of(Items.create(Material.IRON_TRAPDOOR,
"&6Iron Trapdoor Interaction", ENABLED_LORE),
"&6Iron Trapdoor Interaction", ENABLED_LORE + IRON_TRAPDOOR_LORE),
inventoryClickEvent -> {
IronTrapdoorListener.ironTrapdoorIds.add(player.getUniqueId());
setIronTrapdoorItem(player, contents);
@@ -77,7 +85,7 @@ public class UtilitiesMenuProvider implements InventoryProvider {
} else {
setEnabledGlassPanes(1, false, contents);
contents.set(1, 1, ClickableItem.of(Items.create(Material.IRON_TRAPDOOR,
"&6Iron Trapdoor Interaction", DISABLED_LORE),
"&6Iron Trapdoor Interaction", DISABLED_LORE + IRON_TRAPDOOR_LORE),
inventoryClickEvent -> {
IronTrapdoorListener.ironTrapdoorIds.remove(player.getUniqueId());
setIronTrapdoorItem(player, contents);
@@ -96,7 +104,7 @@ public class UtilitiesMenuProvider implements InventoryProvider {
if (!BlockBreakListener.slabIds.contains(player.getUniqueId())) {
setEnabledGlassPanes(2, true, contents);
contents.set(1, 2, ClickableItem.of(Items.create(Material.STONE_SLAB,
"&6Custom Slab Breaking", ENABLED_LORE),
"&6Custom Slab Breaking", ENABLED_LORE + SLAB_BREAKING_LORE),
inventoryClickEvent -> {
BlockBreakListener.slabIds.add(player.getUniqueId());
setSlabItem(player, contents);
@@ -104,7 +112,7 @@ public class UtilitiesMenuProvider implements InventoryProvider {
} else {
setEnabledGlassPanes(2, false, contents);
contents.set(1, 2, ClickableItem.of(Items.create(Material.STONE_SLAB,
"&6Custom Slab Breaking", DISABLED_LORE),
"&6Custom Slab Breaking", DISABLED_LORE + SLAB_BREAKING_LORE),
inventoryClickEvent -> {
BlockBreakListener.slabIds.remove(player.getUniqueId());
setSlabItem(player, contents);
@@ -123,7 +131,7 @@ public class UtilitiesMenuProvider implements InventoryProvider {
if (!TerracottaInteractListener.terracottaIds.contains(player.getUniqueId())) {
setEnabledGlassPanes(3, true, contents);
contents.set(1, 3, ClickableItem.of(Items.create(Material.ORANGE_GLAZED_TERRACOTTA,
"&6Glazed Terracotta Rotating", ENABLED_LORE),
"&6Glazed Terracotta Rotating", ENABLED_LORE + GLAZED_ROTATING_LORE),
inventoryClickEvent -> {
TerracottaInteractListener.terracottaIds.add(player.getUniqueId());
setTerracottaItem(player, contents);
@@ -131,7 +139,7 @@ public class UtilitiesMenuProvider implements InventoryProvider {
} else {
setEnabledGlassPanes(3, false, contents);
contents.set(1, 3, ClickableItem.of(Items.create(Material.ORANGE_GLAZED_TERRACOTTA,
"&6Glazed Terracotta Rotating", DISABLED_LORE),
"&6Glazed Terracotta Rotating", DISABLED_LORE + GLAZED_ROTATING_LORE),
inventoryClickEvent -> {
TerracottaInteractListener.terracottaIds.remove(player.getUniqueId());
setTerracottaItem(player, contents);
@@ -151,7 +159,7 @@ public class UtilitiesMenuProvider implements InventoryProvider {
if (player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
setEnabledGlassPanes(5, true, contents);
contents.set(1, 5, ClickableItem.of(Items.create(Material.ENDER_EYE,
"&6Night Vision", ENABLED_LORE),
"&6Night Vision", ENABLED_LORE + NIGHT_VISION_LORE),
inventoryClickEvent -> {
player.removePotionEffect(PotionEffectType.NIGHT_VISION);
setNightVisionItem(player, contents);
@@ -159,7 +167,7 @@ public class UtilitiesMenuProvider implements InventoryProvider {
} else {
setEnabledGlassPanes(5, false, contents);
contents.set(1, 5, ClickableItem.of(Items.create(Material.ENDER_EYE,
"&6Night Vision", DISABLED_LORE),
"&6Night Vision", DISABLED_LORE + NIGHT_VISION_LORE),
inventoryClickEvent -> {
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 0, true, false));
setNightVisionItem(player, contents);
@@ -178,7 +186,7 @@ public class UtilitiesMenuProvider implements InventoryProvider {
if (NoClipManager.noClipPlayerIds.contains(player.getUniqueId())) {
setEnabledGlassPanes(6, true, contents);
contents.set(1, 6, ClickableItem.of(Items.create(Material.COMPASS,
"&6No Clip", ENABLED_LORE),
"&6No Clip", ENABLED_LORE + NO_CLIP_LORE),
inventoryClickEvent -> {
NoClipManager.noClipPlayerIds.remove(player.getUniqueId());
setNoClipItem(player, contents);
@@ -186,7 +194,7 @@ public class UtilitiesMenuProvider implements InventoryProvider {
} else {
setEnabledGlassPanes(6, false, contents);
contents.set(1, 6, ClickableItem.of(Items.create(Material.COMPASS,
"&6No Clip", DISABLED_LORE),
"&6No Clip", DISABLED_LORE + NO_CLIP_LORE),
inventoryClickEvent -> {
NoClipManager.noClipPlayerIds.add(player.getUniqueId());
setNoClipItem(player, contents);
@@ -205,7 +213,7 @@ public class UtilitiesMenuProvider implements InventoryProvider {
if (PlayerMoveListener.enabledPlayers.contains(player.getUniqueId())) {
setEnabledGlassPanes(7, true, contents);
contents.set(1, 7, ClickableItem.of(Items.create(Material.FEATHER,
"&6Advanced Fly", ENABLED_LORE),
"&6Advanced Fly", ENABLED_LORE + ADVANCED_FLY_LORE),
inventoryClickEvent -> {
PlayerMoveListener.enabledPlayers.remove(player.getUniqueId());
setFlyItem(player, contents);
@@ -213,7 +221,7 @@ public class UtilitiesMenuProvider implements InventoryProvider {
} else {
setEnabledGlassPanes(7, false, contents);
contents.set(1, 7, ClickableItem.of(Items.create(Material.FEATHER,
"&6Advanced Fly", DISABLED_LORE),
"&6Advanced Fly", DISABLED_LORE + ADVANCED_FLY_LORE),
inventoryClickEvent -> {
PlayerMoveListener.enabledPlayers.add(player.getUniqueId());
setFlyItem(player, contents);