From 4a4ee986d57bb8dd2df2be48e3a2bb80571a2e63 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Thu, 22 Dec 2016 09:33:31 -0500 Subject: [PATCH 01/10] Changed Filepaths --- .../components/metrics/MetricsComponent.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/buttondevteam/alipresents/components/metrics/MetricsComponent.java b/src/buttondevteam/alipresents/components/metrics/MetricsComponent.java index ea57a09..0e561a6 100644 --- a/src/buttondevteam/alipresents/components/metrics/MetricsComponent.java +++ b/src/buttondevteam/alipresents/components/metrics/MetricsComponent.java @@ -11,15 +11,20 @@ import buttondevteam.alipresents.components.metrics.files.MetricsFile; import buttondevteam.alipresents.components.metrics.output.GetLoginMetrics; public class MetricsComponent extends Component{ - String defaultPath = "src/alisolarflare/resources"; - String defaultFilePath = (defaultPath + "/metrics.txt"); - String playerLoginsFilePath = (defaultPath + "/playerLogins.txt"); + String defaultPath; + String defaultFilePath; + String playerLoginsFilePath; public MetricsFile playerLoginsFile; // DATA - STRING public List metricsList; @Override public void register(JavaPlugin plugin){ + + defaultPath = plugin.getDataFolder().getAbsolutePath(); + defaultFilePath = defaultPath + "/metrics.txt"; + playerLoginsFilePath = defaultPath + "/playerLogins.txt"; + playerLoginsFile = new MetricsFile(playerLoginsFilePath); registerCommand(plugin, new GetLoginMetrics(this)); registerListener(plugin, new PlayerJoinListener(this, playerLoginsFile)); -- 2.30.2 From 956fdf81fc2b8617116186823bd3f4f7b8cd93e9 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 24 Dec 2016 03:43:43 -0500 Subject: [PATCH 02/10] Made a default save path for the cannon bow --- .../components/magic/tricks/CannonBowListener.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/buttondevteam/alipresents/components/magic/tricks/CannonBowListener.java b/src/buttondevteam/alipresents/components/magic/tricks/CannonBowListener.java index 85dbd81..cee7da0 100644 --- a/src/buttondevteam/alipresents/components/magic/tricks/CannonBowListener.java +++ b/src/buttondevteam/alipresents/components/magic/tricks/CannonBowListener.java @@ -20,29 +20,30 @@ import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; public class CannonBowListener implements Listener { - + private static String savePath = "magic.cannonbow"; + private static double maxSpeedMultiplier = 4; private static double minSpeedMultiplier = 0; private static double defaultSpeedMultiplier = 1; - private static String speedMultiplierPath = "magic.cannonbow.speedmultiplier"; + private static String speedMultiplierPath = savePath + ".speedmultiplier"; private static int maxFuseTicks = 400; private static int minFuseTicks = 0; private static int defaultFuseTicks = 30; - private static String fuseTicksPath = "magic.cannonbow.fuseticks"; + private static String fuseTicksPath = savePath + ".fuseticks"; private static double maxMinForce = 1; private static double minMinForce = 0; private static double defaultMinForce = 0.2; - private static String minForcePath = "magic.cannonbow.minforce"; + private static String minForcePath = savePath + ".minforce"; private static double maxRecoil = 20; private static double minRecoil = -5; private static double defaultRecoil = 1; - private static String recoilPath = "magic.cannonbow.recoil"; + private static String recoilPath = savePath + ".recoil"; private static boolean defaultIsDestructive = false; - private static String isDestructivePath = "magic.cannonbow.isdestructive"; + private static String isDestructivePath = savePath + ".isdestructive"; private static double speedMultiplier = defaultSpeedMultiplier; private static double minForce = defaultMinForce; -- 2.30.2 From dc57298c04fb319efa6c28f7422aec84f6d33b9f Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Mon, 26 Dec 2016 22:40:35 -0500 Subject: [PATCH 03/10] Disabled main world creative block --- .../components/hotfix/HotfixComponent.java | 55 ++++++++++--------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/src/buttondevteam/alipresents/components/hotfix/HotfixComponent.java b/src/buttondevteam/alipresents/components/hotfix/HotfixComponent.java index abd2393..c0da11c 100644 --- a/src/buttondevteam/alipresents/components/hotfix/HotfixComponent.java +++ b/src/buttondevteam/alipresents/components/hotfix/HotfixComponent.java @@ -1,27 +1,28 @@ -package buttondevteam.alipresents.components.hotfix; - -import org.bukkit.Bukkit; -import org.bukkit.plugin.java.JavaPlugin; - -import com.earth2me.essentials.Essentials; - -import buttondevteam.alipresents.architecture.Component; -import buttondevteam.alipresents.components.hotfix.hotfixes.CowSpawnLoop; -import buttondevteam.alipresents.components.hotfix.hotfixes.CreativeKillLoop; -import buttondevteam.alipresents.components.hotfix.hotfixes.GrassBreakListener; -import buttondevteam.alipresents.components.hotfix.hotfixes.MobKillListener; -import buttondevteam.alipresents.components.hotfix.hotfixes.NetherDisableListener; - -public class HotfixComponent extends Component { - - @Override - public void register(JavaPlugin plugin) { - registerListener(plugin, new NetherDisableListener()); - registerListener(plugin, new CowSpawnLoop(plugin)); - registerListener(plugin, new MobKillListener((Essentials) Bukkit.getPluginManager().getPlugin("Essentials"))); - registerListener(plugin, new GrassBreakListener()); - registerListener(plugin, new CreativeKillLoop(plugin)); - - } - -} +package buttondevteam.alipresents.components.hotfix; + +import org.bukkit.Bukkit; +import org.bukkit.plugin.java.JavaPlugin; + +import com.earth2me.essentials.Essentials; + +import buttondevteam.alipresents.architecture.Component; +import buttondevteam.alipresents.components.hotfix.hotfixes.CowSpawnLoop; +import buttondevteam.alipresents.components.hotfix.hotfixes.ElytraFireworks; +import buttondevteam.alipresents.components.hotfix.hotfixes.GrassBreakListener; +import buttondevteam.alipresents.components.hotfix.hotfixes.MobKillListener; +import buttondevteam.alipresents.components.hotfix.hotfixes.NetherDisableListener; + +public class HotfixComponent extends Component { + + @Override + public void register(JavaPlugin plugin) { + registerListener(plugin, new NetherDisableListener()); + registerListener(plugin, new CowSpawnLoop(plugin)); + registerListener(plugin, new MobKillListener((Essentials) Bukkit.getPluginManager().getPlugin("Essentials"))); + registerListener(plugin, new GrassBreakListener()); + //registerListener(plugin, new CreativeKillLoop(plugin)); + registerListener(plugin, new ElytraFireworks(plugin)); + + } + +} -- 2.30.2 From 8ab502183444068af7ffe27bd27dbd870dca5276 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Mon, 26 Dec 2016 22:42:41 -0500 Subject: [PATCH 04/10] Adjusted fireworks and dungeon --- .../dungeons/dungeons/GenericDungeonA1.java | 186 +++++++++--------- .../hotfix/hotfixes/ElytraFireworks.java | 36 ++++ 2 files changed, 131 insertions(+), 91 deletions(-) create mode 100644 src/buttondevteam/alipresents/components/hotfix/hotfixes/ElytraFireworks.java diff --git a/src/buttondevteam/alipresents/components/dungeons/dungeons/GenericDungeonA1.java b/src/buttondevteam/alipresents/components/dungeons/dungeons/GenericDungeonA1.java index b8ad2bd..c04e93d 100644 --- a/src/buttondevteam/alipresents/components/dungeons/dungeons/GenericDungeonA1.java +++ b/src/buttondevteam/alipresents/components/dungeons/dungeons/GenericDungeonA1.java @@ -1,91 +1,95 @@ -package buttondevteam.alipresents.components.dungeons.dungeons; - -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.plugin.java.JavaPlugin; - -public class GenericDungeonA1 extends Dungeon{ - private Location entrance; - private Location exit; - private JavaPlugin plugin; - - public GenericDungeonA1(JavaPlugin plugin){ - if(!initDungeon(plugin)){ - plugin.getServer().broadcastMessage("DungeonA1 cant be initialized!"); - } - this.plugin = plugin; - } - private boolean initDungeon(JavaPlugin plugin){ - /* - if (plugin.getServer().getWorld("Dungeons") == null || plugin.getServer().getWorld("world") == null){ - plugin.getServer().broadcastMessage("GenericDungeonA1Error! One of the worlds is null!"); - plugin.getServer().broadcastMessage("Available Worlds... " + plugin.getServer().getWorlds().toString()); - return false; - }*/ - Location temp; - if ((temp = loadLocation(plugin, "dungeons.dungeona1.enter")) != null){ - entrance = temp; - }else if(plugin.getServer().getWorld("Dungeons") != null){ - entrance = new Location(plugin.getServer().getWorld("Dungeons"), -7.5, 138.0, -91.5); - }else{ - plugin.getServer().broadcastMessage("There is no working default dungeon entrance for A1, setting to null"); - entrance = null; - } - - temp = null; - if ((temp = loadLocation(plugin, "dungeons.dungeona1.exit")) != null){ - exit = temp; - }else if (plugin.getServer().getWorld("world") != null){ - exit = plugin.getServer().getWorld("world").getSpawnLocation().clone(); - }else{ - plugin.getServer().broadcastMessage("There is no working default dungeon exit for A1, setting to null"); - exit = null; - } - - if (entrance == null || exit == null){ - plugin.getServer().broadcastMessage("DungeonA1Error! Dungeon Entrance or Exit is null!"); - plugin.getServer().broadcastMessage("Dungeon Entrance: " + entrance.toString()); - plugin.getServer().broadcastMessage("Dungeon Exit: " + exit.toString()); - return false; - } - return true; - } - @Override - public void setEntrance(Location location){ - saveLocation(plugin, "dungeons.dungeona1.enter", location); - entrance = location; - } - @Override - public void setExit(Location location){ - saveLocation(plugin, "dungeons.dungeona1.exit", location); - exit = location; - } - @Override - public Location getDungeonEntrance() { - return entrance; - } - @Override - public Location getDungeonExit() { - return exit; - } - private void saveLocation(JavaPlugin plugin, String path, Location location){ - plugin.getConfig().set(path+".world", location.getWorld().getName()); - plugin.getConfig().set(path+".x", location.getX()); - plugin.getConfig().set(path+".y", location.getY()); - plugin.getConfig().set(path+".z", location.getZ()); - plugin.saveConfig(); - } - private Location loadLocation(JavaPlugin plugin, String path){ - try{ - World world = plugin.getServer().getWorld(plugin.getConfig().getString(path+".world")); - double x = plugin.getConfig().getDouble(path+".x"); - double y = plugin.getConfig().getDouble(path+".y"); - double z = plugin.getConfig().getDouble(path+".z"); - - return new Location(world, x, y, z); - }catch(Exception e){ - e.printStackTrace(); - return null; - } - } -} +package buttondevteam.alipresents.components.dungeons.dungeons; + +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.plugin.java.JavaPlugin; + +public class GenericDungeonA1 extends Dungeon{ + private Location entrance; + private Location exit; + private JavaPlugin plugin; + + public GenericDungeonA1(JavaPlugin plugin){ + if(!initDungeon(plugin)){ + plugin.getServer().broadcastMessage("DungeonA1 cant be initialized!"); + } + this.plugin = plugin; + } + private boolean initDungeon(JavaPlugin plugin){ + /* + if (plugin.getServer().getWorld("Dungeons") == null || plugin.getServer().getWorld("world") == null){ + plugin.getServer().broadcastMessage("GenericDungeonA1Error! One of the worlds is null!"); + plugin.getServer().broadcastMessage("Available Worlds... " + plugin.getServer().getWorlds().toString()); + return false; + }*/ + Location temp; + if ((temp = loadLocation(plugin, "dungeons.dungeona1.enter")) != null){ + entrance = temp; + }else if(plugin.getServer().getWorld("Dungeons") != null){ + entrance = new Location(plugin.getServer().getWorld("Dungeons"), -7.5, 138.0, -91.5); + }else{ + plugin.getServer().broadcastMessage("There is no working default dungeon entrance for A1, setting to null"); + entrance = null; + } + + temp = null; + if ((temp = loadLocation(plugin, "dungeons.dungeona1.exit")) != null){ + exit = temp; + }else if (plugin.getServer().getWorld("world") != null){ + exit = plugin.getServer().getWorld("world").getSpawnLocation().clone(); + }else{ + plugin.getServer().broadcastMessage("There is no working default dungeon exit for A1, setting to null"); + exit = null; + } + + if (entrance == null || exit == null){ + plugin.getServer().broadcastMessage("DungeonA1Error! Dungeon Entrance or Exit is null!"); + plugin.getServer().broadcastMessage("Dungeon Entrance: " + entrance.toString()); + plugin.getServer().broadcastMessage("Dungeon Exit: " + exit.toString()); + return false; + } + return true; + } + @Override + public void setEntrance(Location location){ + saveLocation(plugin, "dungeons.dungeona1.enter", location); + entrance = location; + } + @Override + public void setExit(Location location){ + saveLocation(plugin, "dungeons.dungeona1.exit", location); + exit = location; + } + @Override + public Location getDungeonEntrance() { + return entrance; + } + @Override + public Location getDungeonExit() { + return exit; + } + private void saveLocation(JavaPlugin plugin, String path, Location location){ + plugin.getConfig().set(path+".world", location.getWorld().getName()); + plugin.getConfig().set(path+".x", location.getX()); + plugin.getConfig().set(path+".y", location.getY()); + plugin.getConfig().set(path+".z", location.getZ()); + plugin.saveConfig(); + } + private Location loadLocation(JavaPlugin plugin, String path){ + try{ + String worldname = plugin.getConfig().getString(path+".world"); + if(worldname == null) return null; + + World world = plugin.getServer().getWorld(worldname); + double x = plugin.getConfig().getDouble(path+".x"); + double y = plugin.getConfig().getDouble(path+".y"); + double z = plugin.getConfig().getDouble(path+".z"); + if (world == null) return null; + + return new Location(world, x, y, z); + }catch(Exception e){ + e.printStackTrace(); + return null; + } + } +} diff --git a/src/buttondevteam/alipresents/components/hotfix/hotfixes/ElytraFireworks.java b/src/buttondevteam/alipresents/components/hotfix/hotfixes/ElytraFireworks.java new file mode 100644 index 0000000..c7101a7 --- /dev/null +++ b/src/buttondevteam/alipresents/components/hotfix/hotfixes/ElytraFireworks.java @@ -0,0 +1,36 @@ +package buttondevteam.alipresents.components.hotfix.hotfixes; + +import org.bukkit.FireworkEffect; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.FireworkMeta; +import org.bukkit.plugin.java.JavaPlugin; + +public class ElytraFireworks implements Listener { + JavaPlugin plugin; + public ElytraFireworks(JavaPlugin plugin) { + this.plugin = plugin; + } + public void onRightClick(PlayerInteractEvent event){ + //ACTION SANITATION + if(!(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) return; + if(!(event.getPlayer().isGliding())) return; + if(!(event.getMaterial() == Material.FIREWORK)) return; + + //BOW SANITATION + ItemStack firework = event.getItem(); + FireworkMeta fireworkMeta= (FireworkMeta) firework.getItemMeta(); + for (FireworkEffect effect : fireworkMeta.getEffects()){ + event.getPlayer().sendMessage(effect.toString()); + } + + //PLAYER SANITATION + Player player = event.getPlayer(); + if(player.getGameMode().equals(GameMode.SPECTATOR))return; + } +} -- 2.30.2 From a026fc5e60edca5c949c4bb6de424514cb8e66a3 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Mon, 26 Dec 2016 22:46:02 -0500 Subject: [PATCH 05/10] Fixed error --- .../alipresents/components/hotfix/HotfixComponent.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/buttondevteam/alipresents/components/hotfix/HotfixComponent.java b/src/buttondevteam/alipresents/components/hotfix/HotfixComponent.java index c0da11c..c9ac0c2 100644 --- a/src/buttondevteam/alipresents/components/hotfix/HotfixComponent.java +++ b/src/buttondevteam/alipresents/components/hotfix/HotfixComponent.java @@ -7,7 +7,6 @@ import com.earth2me.essentials.Essentials; import buttondevteam.alipresents.architecture.Component; import buttondevteam.alipresents.components.hotfix.hotfixes.CowSpawnLoop; -import buttondevteam.alipresents.components.hotfix.hotfixes.ElytraFireworks; import buttondevteam.alipresents.components.hotfix.hotfixes.GrassBreakListener; import buttondevteam.alipresents.components.hotfix.hotfixes.MobKillListener; import buttondevteam.alipresents.components.hotfix.hotfixes.NetherDisableListener; @@ -21,7 +20,6 @@ public class HotfixComponent extends Component { registerListener(plugin, new MobKillListener((Essentials) Bukkit.getPluginManager().getPlugin("Essentials"))); registerListener(plugin, new GrassBreakListener()); //registerListener(plugin, new CreativeKillLoop(plugin)); - registerListener(plugin, new ElytraFireworks(plugin)); } -- 2.30.2 From f665665fcd4f678bcc18629ddf1c0e93b0fe2c6f Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Mon, 26 Dec 2016 23:23:47 -0500 Subject: [PATCH 06/10] Creative kill applies outside spawn --- .../components/hotfix/HotfixComponent.java | 3 +- .../hotfix/hotfixes/CreativeKillLoop.java | 64 +++++++++++-------- 2 files changed, 39 insertions(+), 28 deletions(-) diff --git a/src/buttondevteam/alipresents/components/hotfix/HotfixComponent.java b/src/buttondevteam/alipresents/components/hotfix/HotfixComponent.java index c9ac0c2..708d127 100644 --- a/src/buttondevteam/alipresents/components/hotfix/HotfixComponent.java +++ b/src/buttondevteam/alipresents/components/hotfix/HotfixComponent.java @@ -7,6 +7,7 @@ import com.earth2me.essentials.Essentials; import buttondevteam.alipresents.architecture.Component; import buttondevteam.alipresents.components.hotfix.hotfixes.CowSpawnLoop; +import buttondevteam.alipresents.components.hotfix.hotfixes.CreativeKillLoop; import buttondevteam.alipresents.components.hotfix.hotfixes.GrassBreakListener; import buttondevteam.alipresents.components.hotfix.hotfixes.MobKillListener; import buttondevteam.alipresents.components.hotfix.hotfixes.NetherDisableListener; @@ -19,7 +20,7 @@ public class HotfixComponent extends Component { registerListener(plugin, new CowSpawnLoop(plugin)); registerListener(plugin, new MobKillListener((Essentials) Bukkit.getPluginManager().getPlugin("Essentials"))); registerListener(plugin, new GrassBreakListener()); - //registerListener(plugin, new CreativeKillLoop(plugin)); + registerListener(plugin, new CreativeKillLoop(plugin)); } diff --git a/src/buttondevteam/alipresents/components/hotfix/hotfixes/CreativeKillLoop.java b/src/buttondevteam/alipresents/components/hotfix/hotfixes/CreativeKillLoop.java index e90ea0a..7e759b2 100644 --- a/src/buttondevteam/alipresents/components/hotfix/hotfixes/CreativeKillLoop.java +++ b/src/buttondevteam/alipresents/components/hotfix/hotfixes/CreativeKillLoop.java @@ -1,27 +1,37 @@ -package buttondevteam.alipresents.components.hotfix.hotfixes; - -import org.bukkit.GameMode; -import org.bukkit.entity.Player; -import org.bukkit.event.Listener; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.scheduler.BukkitRunnable; - -public class CreativeKillLoop extends BukkitRunnable implements Listener { - private JavaPlugin plugin; - - public CreativeKillLoop(JavaPlugin plugin){ - this.plugin = plugin; - this.runTaskTimer(plugin, 40, 40); - } - - @Override - public void run() { - for (Player player : plugin.getServer().getOnlinePlayers()){ - if(player.getGameMode() != GameMode.SURVIVAL && player.getWorld().getName().equalsIgnoreCase("world") && player.isOp() == false){ - player.sendMessage("[Hotfix] Every Gamemode other than survival is disabled in the new world!"); - player.setGameMode(GameMode.SURVIVAL); - } - } - } - -} +package buttondevteam.alipresents.components.hotfix.hotfixes; + +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitRunnable; + +public class CreativeKillLoop extends BukkitRunnable implements Listener { + private JavaPlugin plugin; + + public CreativeKillLoop(JavaPlugin plugin){ + this.plugin = plugin; + this.runTaskTimer(plugin, 40, 40); + } + + @Override + public void run() { + Location location; + for (Player player : plugin.getServer().getOnlinePlayers()){ + if (player.getGameMode() == GameMode.SURVIVAL) continue; + if (player.getWorld().getName().equalsIgnoreCase("world")) continue; + if (player.isOp()) continue; + + location = player.getLocation(); + if (250 > location.getBlockX() && location.getBlockX() > -250) continue; + if (250 > location.getBlockZ() && location.getBlockZ() > -250) continue; + + player.sendMessage("[Hotfix] Every Gamemode other than survival is disabled in the new world!"); + player.setGameMode(GameMode.SURVIVAL); + + } + + } + +} -- 2.30.2 From f843ea0380b8aeade755caf507d6c15e8d9302ef Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Mon, 26 Dec 2016 23:39:33 -0500 Subject: [PATCH 07/10] Testing in production --- .../components/hotfix/hotfixes/CreativeKillLoop.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/buttondevteam/alipresents/components/hotfix/hotfixes/CreativeKillLoop.java b/src/buttondevteam/alipresents/components/hotfix/hotfixes/CreativeKillLoop.java index 7e759b2..cc5a3aa 100644 --- a/src/buttondevteam/alipresents/components/hotfix/hotfixes/CreativeKillLoop.java +++ b/src/buttondevteam/alipresents/components/hotfix/hotfixes/CreativeKillLoop.java @@ -20,12 +20,12 @@ public class CreativeKillLoop extends BukkitRunnable implements Listener { Location location; for (Player player : plugin.getServer().getOnlinePlayers()){ if (player.getGameMode() == GameMode.SURVIVAL) continue; - if (player.getWorld().getName().equalsIgnoreCase("world")) continue; + if (!player.getWorld().getName().equalsIgnoreCase("world")) continue; if (player.isOp()) continue; location = player.getLocation(); - if (250 > location.getBlockX() && location.getBlockX() > -250) continue; - if (250 > location.getBlockZ() && location.getBlockZ() > -250) continue; + if (location.getBlockX() < 250 && location.getBlockX() > -250) continue; + if (location.getBlockZ() < 250 && location.getBlockZ() > -250) continue; player.sendMessage("[Hotfix] Every Gamemode other than survival is disabled in the new world!"); player.setGameMode(GameMode.SURVIVAL); -- 2.30.2 From 13fb77a27342fbecd00eec3f9b4c4c6db92ebdb7 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Mon, 26 Dec 2016 23:55:09 -0500 Subject: [PATCH 08/10] Added more informational dialouge --- .../components/hotfix/hotfixes/CreativeKillLoop.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/buttondevteam/alipresents/components/hotfix/hotfixes/CreativeKillLoop.java b/src/buttondevteam/alipresents/components/hotfix/hotfixes/CreativeKillLoop.java index cc5a3aa..e8f7680 100644 --- a/src/buttondevteam/alipresents/components/hotfix/hotfixes/CreativeKillLoop.java +++ b/src/buttondevteam/alipresents/components/hotfix/hotfixes/CreativeKillLoop.java @@ -22,12 +22,15 @@ public class CreativeKillLoop extends BukkitRunnable implements Listener { if (player.getGameMode() == GameMode.SURVIVAL) continue; if (!player.getWorld().getName().equalsIgnoreCase("world")) continue; if (player.isOp()) continue; + + player.sendMessage("[Hotfix] Every Gamemode other than survival is disabled in the new world"); + player.setGameMode(GameMode.SURVIVAL); location = player.getLocation(); if (location.getBlockX() < 250 && location.getBlockX() > -250) continue; if (location.getBlockZ() < 250 && location.getBlockZ() > -250) continue; - player.sendMessage("[Hotfix] Every Gamemode other than survival is disabled in the new world!"); + player.sendMessage("[Hotfix] Unless you are in Spawn Island!"); player.setGameMode(GameMode.SURVIVAL); } -- 2.30.2 From c517296a0a1d1b29325844fc8e1fa25c39a99249 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Wed, 28 Dec 2016 23:41:15 -0500 Subject: [PATCH 09/10] Started work on refactoring Gpowers --- .../components/gpower/ApplyPowerUp.java | 55 +++++++++++++++++++ .../components/gpower/GPowerComponent.java | 4 +- .../components/gpower/api/GPowerAPI.java | 8 ++- .../components/magic/MagicComponent.java | 8 ++- .../magic/tricks/CannonBowListener.java | 34 ++++++------ 5 files changed, 87 insertions(+), 22 deletions(-) create mode 100644 src/buttondevteam/alipresents/components/gpower/ApplyPowerUp.java diff --git a/src/buttondevteam/alipresents/components/gpower/ApplyPowerUp.java b/src/buttondevteam/alipresents/components/gpower/ApplyPowerUp.java new file mode 100644 index 0000000..52c6d93 --- /dev/null +++ b/src/buttondevteam/alipresents/components/gpower/ApplyPowerUp.java @@ -0,0 +1,55 @@ +package buttondevteam.alipresents.components.gpower; + +import org.bukkit.entity.Player; + +import buttondevteam.alipresents.architecture.commands.ModCommand; +import buttondevteam.alipresents.components.gpower.api.GPowerAPI; + +public class ApplyPowerUp extends ModCommand { + + @Override + public boolean OnCommand(Player player, String alias, String[] args) { + if (args.length > 1) //No one's online + return false; + + String playerArgument = args[0]; + + Player argPlayer = player.getServer().getPlayer(playerArgument); + + if (argPlayer == null) + { + + // Attempted player is not online + player.sendMessage(playerArgument + " is not online right now. Players online are: "); + player.sendMessage(player.getServer().getOnlinePlayers().toString()); + + if (args.length < 2){ + player.sendMessage("You may apply the effect " + args[1] + "to them"); + } + + } + if (args.length < 2){ + //recolour no colour + GPowerAPI.PowerUpPlayer(player); + return true; + }else{ + GPowerAPI.PowerUpPlayer(player); + //recolour with colour + return true; + } + + + } + @Override + public String[] GetHelpText(String string){ + return new String[]{ + "Usage: /"+GetCommandPath()+" ", + "Use this command to apply a gpower colour to players", + }; + } + @Override + public String GetCommandPath(){ + return "gpower applypowerup"; + } + +} diff --git a/src/buttondevteam/alipresents/components/gpower/GPowerComponent.java b/src/buttondevteam/alipresents/components/gpower/GPowerComponent.java index 1d85e84..7fda859 100644 --- a/src/buttondevteam/alipresents/components/gpower/GPowerComponent.java +++ b/src/buttondevteam/alipresents/components/gpower/GPowerComponent.java @@ -15,7 +15,9 @@ public class GPowerComponent extends Component { registerCommand(plugin, new Test()); registerCommand(plugin, new PowerUp()); registerCommand(plugin, new PowerDown()); - + + registerCommand(plugin, new ApplyPowerUp()); + registerCommand(plugin, new ApplyPowerDown()); registerListener(plugin, new EnchantingLoop(plugin)); } diff --git a/src/buttondevteam/alipresents/components/gpower/api/GPowerAPI.java b/src/buttondevteam/alipresents/components/gpower/api/GPowerAPI.java index 3596613..d497f69 100644 --- a/src/buttondevteam/alipresents/components/gpower/api/GPowerAPI.java +++ b/src/buttondevteam/alipresents/components/gpower/api/GPowerAPI.java @@ -18,6 +18,9 @@ public class GPowerAPI{ public static void addPlayer(Player player, String colour, boolean powerIsActive){ poweredPlayerList.put(player.getUniqueId(), new PoweredPlayer(player.getUniqueId(), colour, true)); } + public static void PowerUpPlayer(Player player, String colour){ + PowerUpPlayer(player); + } public static void PowerUpPlayer(Player player){ player.sendMessage("Powering up!"); if(poweredPlayerList.containsKey(player.getUniqueId())){ @@ -33,14 +36,15 @@ public class GPowerAPI{ } } - public static void PowerDownPlayer(Player player){ + public static boolean PowerDownPlayer(Player player){ player.sendMessage("Powering down!"); if (poweredPlayerList.containsKey(player.getUniqueId())){ player.sendMessage("Powered down!"); poweredPlayerList.get(player.getUniqueId()).isPowersActive = false; + return true; }else{ player.sendMessage("P down!"); - return; + return false; } } diff --git a/src/buttondevteam/alipresents/components/magic/MagicComponent.java b/src/buttondevteam/alipresents/components/magic/MagicComponent.java index 8aa4b27..444cc74 100644 --- a/src/buttondevteam/alipresents/components/magic/MagicComponent.java +++ b/src/buttondevteam/alipresents/components/magic/MagicComponent.java @@ -7,17 +7,19 @@ import buttondevteam.alipresents.components.magic.tricks.AliArrowListener; import buttondevteam.alipresents.components.magic.tricks.BoomBowDeathListener; import buttondevteam.alipresents.components.magic.tricks.BoomBowListener; import buttondevteam.alipresents.components.magic.tricks.CannonBowListener; -import buttondevteam.alipresents.components.magic.tricks.CannonBowSettings; public class MagicComponent extends Component{ @Override public void register(JavaPlugin plugin) { - registerCommand(plugin, new CannonBowSettings()); + //registerCommand(plugin, new CannonBowSettings()); registerListener(plugin, new AliArrowListener(plugin)); registerListener(plugin, new BoomBowDeathListener()); registerListener(plugin, new BoomBowListener(plugin)); - registerListener(plugin, new CannonBowListener(plugin)); + + CannonBowListener cbl = new CannonBowListener(plugin); + //cbl.loadSettings(plugin.getConfig()); + registerListener(plugin, cbl); } } diff --git a/src/buttondevteam/alipresents/components/magic/tricks/CannonBowListener.java b/src/buttondevteam/alipresents/components/magic/tricks/CannonBowListener.java index cee7da0..ef321f3 100644 --- a/src/buttondevteam/alipresents/components/magic/tricks/CannonBowListener.java +++ b/src/buttondevteam/alipresents/components/magic/tricks/CannonBowListener.java @@ -56,23 +56,8 @@ public class CannonBowListener implements Listener { static FileConfiguration config; public CannonBowListener(JavaPlugin plugin){ config = plugin.getConfig(); - - if (config.isDouble(speedMultiplierPath)) - setSpeedMultiplier(config.getDouble(speedMultiplierPath)); - - if (config.isDouble(minForcePath)) - setMinforce(config.getDouble(minForcePath)); - - if (config.isInt(fuseTicksPath)) - setFuseticks(config.getInt(fuseTicksPath)); - - if (config.isDouble(recoilPath)) - setRecoil(config.getDouble(recoilPath)); - - if (config.isBoolean(isDestructivePath)) - setIsDestructive(config.getBoolean(isDestructivePath)); } - + @EventHandler public void onProjectileLaunch(EntityShootBowEvent event){ //Entity Sanitation @@ -247,4 +232,21 @@ public class CannonBowListener implements Listener { CannonBowListener.isDestructive = isDestructive; config.set(speedMultiplierPath, isDestructive); } + + public void loadSettings(FileConfiguration config){ + if (config.isDouble(speedMultiplierPath)) + setSpeedMultiplier(config.getDouble(speedMultiplierPath)); + + if (config.isDouble(minForcePath)) + setMinforce(config.getDouble(minForcePath)); + + if (config.isInt(fuseTicksPath)) + setFuseticks(config.getInt(fuseTicksPath)); + + if (config.isDouble(recoilPath)) + setRecoil(config.getDouble(recoilPath)); + + if (config.isBoolean(isDestructivePath)) + setIsDestructive(config.getBoolean(isDestructivePath)); + } } \ No newline at end of file -- 2.30.2 From 50f5ccf9c145fa8a702db73dd5e9e24c38c16529 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Thu, 29 Dec 2016 20:45:28 -0500 Subject: [PATCH 10/10] Revert "Started work on refactoring Gpowers" This reverts commit c517296a0a1d1b29325844fc8e1fa25c39a99249. --- .../components/gpower/ApplyPowerUp.java | 55 ------------------- .../components/gpower/GPowerComponent.java | 4 +- .../components/gpower/api/GPowerAPI.java | 8 +-- .../components/magic/MagicComponent.java | 8 +-- .../magic/tricks/CannonBowListener.java | 34 ++++++------ 5 files changed, 22 insertions(+), 87 deletions(-) delete mode 100644 src/buttondevteam/alipresents/components/gpower/ApplyPowerUp.java diff --git a/src/buttondevteam/alipresents/components/gpower/ApplyPowerUp.java b/src/buttondevteam/alipresents/components/gpower/ApplyPowerUp.java deleted file mode 100644 index 52c6d93..0000000 --- a/src/buttondevteam/alipresents/components/gpower/ApplyPowerUp.java +++ /dev/null @@ -1,55 +0,0 @@ -package buttondevteam.alipresents.components.gpower; - -import org.bukkit.entity.Player; - -import buttondevteam.alipresents.architecture.commands.ModCommand; -import buttondevteam.alipresents.components.gpower.api.GPowerAPI; - -public class ApplyPowerUp extends ModCommand { - - @Override - public boolean OnCommand(Player player, String alias, String[] args) { - if (args.length > 1) //No one's online - return false; - - String playerArgument = args[0]; - - Player argPlayer = player.getServer().getPlayer(playerArgument); - - if (argPlayer == null) - { - - // Attempted player is not online - player.sendMessage(playerArgument + " is not online right now. Players online are: "); - player.sendMessage(player.getServer().getOnlinePlayers().toString()); - - if (args.length < 2){ - player.sendMessage("You may apply the effect " + args[1] + "to them"); - } - - } - if (args.length < 2){ - //recolour no colour - GPowerAPI.PowerUpPlayer(player); - return true; - }else{ - GPowerAPI.PowerUpPlayer(player); - //recolour with colour - return true; - } - - - } - @Override - public String[] GetHelpText(String string){ - return new String[]{ - "Usage: /"+GetCommandPath()+" ", - "Use this command to apply a gpower colour to players", - }; - } - @Override - public String GetCommandPath(){ - return "gpower applypowerup"; - } - -} diff --git a/src/buttondevteam/alipresents/components/gpower/GPowerComponent.java b/src/buttondevteam/alipresents/components/gpower/GPowerComponent.java index 7fda859..1d85e84 100644 --- a/src/buttondevteam/alipresents/components/gpower/GPowerComponent.java +++ b/src/buttondevteam/alipresents/components/gpower/GPowerComponent.java @@ -15,9 +15,7 @@ public class GPowerComponent extends Component { registerCommand(plugin, new Test()); registerCommand(plugin, new PowerUp()); registerCommand(plugin, new PowerDown()); - - registerCommand(plugin, new ApplyPowerUp()); - registerCommand(plugin, new ApplyPowerDown()); + registerListener(plugin, new EnchantingLoop(plugin)); } diff --git a/src/buttondevteam/alipresents/components/gpower/api/GPowerAPI.java b/src/buttondevteam/alipresents/components/gpower/api/GPowerAPI.java index d497f69..3596613 100644 --- a/src/buttondevteam/alipresents/components/gpower/api/GPowerAPI.java +++ b/src/buttondevteam/alipresents/components/gpower/api/GPowerAPI.java @@ -18,9 +18,6 @@ public class GPowerAPI{ public static void addPlayer(Player player, String colour, boolean powerIsActive){ poweredPlayerList.put(player.getUniqueId(), new PoweredPlayer(player.getUniqueId(), colour, true)); } - public static void PowerUpPlayer(Player player, String colour){ - PowerUpPlayer(player); - } public static void PowerUpPlayer(Player player){ player.sendMessage("Powering up!"); if(poweredPlayerList.containsKey(player.getUniqueId())){ @@ -36,15 +33,14 @@ public class GPowerAPI{ } } - public static boolean PowerDownPlayer(Player player){ + public static void PowerDownPlayer(Player player){ player.sendMessage("Powering down!"); if (poweredPlayerList.containsKey(player.getUniqueId())){ player.sendMessage("Powered down!"); poweredPlayerList.get(player.getUniqueId()).isPowersActive = false; - return true; }else{ player.sendMessage("P down!"); - return false; + return; } } diff --git a/src/buttondevteam/alipresents/components/magic/MagicComponent.java b/src/buttondevteam/alipresents/components/magic/MagicComponent.java index 444cc74..8aa4b27 100644 --- a/src/buttondevteam/alipresents/components/magic/MagicComponent.java +++ b/src/buttondevteam/alipresents/components/magic/MagicComponent.java @@ -7,19 +7,17 @@ import buttondevteam.alipresents.components.magic.tricks.AliArrowListener; import buttondevteam.alipresents.components.magic.tricks.BoomBowDeathListener; import buttondevteam.alipresents.components.magic.tricks.BoomBowListener; import buttondevteam.alipresents.components.magic.tricks.CannonBowListener; +import buttondevteam.alipresents.components.magic.tricks.CannonBowSettings; public class MagicComponent extends Component{ @Override public void register(JavaPlugin plugin) { - //registerCommand(plugin, new CannonBowSettings()); + registerCommand(plugin, new CannonBowSettings()); registerListener(plugin, new AliArrowListener(plugin)); registerListener(plugin, new BoomBowDeathListener()); registerListener(plugin, new BoomBowListener(plugin)); - - CannonBowListener cbl = new CannonBowListener(plugin); - //cbl.loadSettings(plugin.getConfig()); - registerListener(plugin, cbl); + registerListener(plugin, new CannonBowListener(plugin)); } } diff --git a/src/buttondevteam/alipresents/components/magic/tricks/CannonBowListener.java b/src/buttondevteam/alipresents/components/magic/tricks/CannonBowListener.java index ef321f3..cee7da0 100644 --- a/src/buttondevteam/alipresents/components/magic/tricks/CannonBowListener.java +++ b/src/buttondevteam/alipresents/components/magic/tricks/CannonBowListener.java @@ -56,8 +56,23 @@ public class CannonBowListener implements Listener { static FileConfiguration config; public CannonBowListener(JavaPlugin plugin){ config = plugin.getConfig(); + + if (config.isDouble(speedMultiplierPath)) + setSpeedMultiplier(config.getDouble(speedMultiplierPath)); + + if (config.isDouble(minForcePath)) + setMinforce(config.getDouble(minForcePath)); + + if (config.isInt(fuseTicksPath)) + setFuseticks(config.getInt(fuseTicksPath)); + + if (config.isDouble(recoilPath)) + setRecoil(config.getDouble(recoilPath)); + + if (config.isBoolean(isDestructivePath)) + setIsDestructive(config.getBoolean(isDestructivePath)); } - + @EventHandler public void onProjectileLaunch(EntityShootBowEvent event){ //Entity Sanitation @@ -232,21 +247,4 @@ public class CannonBowListener implements Listener { CannonBowListener.isDestructive = isDestructive; config.set(speedMultiplierPath, isDestructive); } - - public void loadSettings(FileConfiguration config){ - if (config.isDouble(speedMultiplierPath)) - setSpeedMultiplier(config.getDouble(speedMultiplierPath)); - - if (config.isDouble(minForcePath)) - setMinforce(config.getDouble(minForcePath)); - - if (config.isInt(fuseTicksPath)) - setFuseticks(config.getInt(fuseTicksPath)); - - if (config.isDouble(recoilPath)) - setRecoil(config.getDouble(recoilPath)); - - if (config.isBoolean(isDestructivePath)) - setIsDestructive(config.getBoolean(isDestructivePath)); - } } \ No newline at end of file -- 2.30.2