From 40a3de76fb2d14e1aeca4a56f60f849c01f40f45 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 3 Jul 2019 00:27:09 -0700 Subject: [PATCH] Static Abuse Removal - More events purged of static abuse, moved some unwanted alchemy code into the dumpster --- .../nossr50/database/SQLDatabaseManager.java | 2 +- .../dumpster/McMMOPlayerBrewEvent.java | 37 +++++++++++++++++++ .../dumpster/McMMOPlayerCatalysisEvent.java | 34 +++++++++++++++++ .../events/skills/McMMOPlayerSkillEvent.java | 9 ----- .../skills/alchemy/McMMOPlayerBrewEvent.java | 37 ------------------- .../alchemy/McMMOPlayerCatalysisEvent.java | 34 ----------------- 6 files changed, 72 insertions(+), 81 deletions(-) create mode 100644 src/main/java/com/gmail/nossr50/dumpster/McMMOPlayerBrewEvent.java create mode 100644 src/main/java/com/gmail/nossr50/dumpster/McMMOPlayerCatalysisEvent.java delete mode 100644 src/main/java/com/gmail/nossr50/events/skills/alchemy/McMMOPlayerBrewEvent.java delete mode 100644 src/main/java/com/gmail/nossr50/events/skills/alchemy/McMMOPlayerCatalysisEvent.java diff --git a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java index 0fc8e21bb..27f16f42b 100644 --- a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java @@ -20,7 +20,7 @@ import java.util.concurrent.locks.ReentrantLock; public final class SQLDatabaseManager implements DatabaseManager { private mcMMO pluginRef; - public final String COM_MYSQL_JDBC_DRIVER = "com.mysql.jdbc.Driver"; + private final String COM_MYSQL_JDBC_DRIVER = "com.mysql.jdbc.Driver"; private final String ALL_QUERY_VERSION = "total"; private final Map cachedUserIDs = new HashMap<>(); private String tablePrefix = pluginRef.getMySQLConfigSettings().getConfigSectionDatabase().getTablePrefix(); diff --git a/src/main/java/com/gmail/nossr50/dumpster/McMMOPlayerBrewEvent.java b/src/main/java/com/gmail/nossr50/dumpster/McMMOPlayerBrewEvent.java new file mode 100644 index 000000000..c81060bee --- /dev/null +++ b/src/main/java/com/gmail/nossr50/dumpster/McMMOPlayerBrewEvent.java @@ -0,0 +1,37 @@ +//package com.gmail.nossr50.events.skills.alchemy; +// +//import com.gmail.nossr50.datatypes.skills.PrimarySkillType; +//import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent; +//import org.bukkit.block.Block; +//import org.bukkit.block.BlockState; +//import org.bukkit.block.BrewingStand; +//import org.bukkit.entity.Player; +//import org.bukkit.event.Cancellable; +// +//public class McMMOPlayerBrewEvent extends McMMOPlayerSkillEvent implements Cancellable { +// private BlockState brewingStand; +// +// private boolean cancelled; +// +// public McMMOPlayerBrewEvent(Player player, BlockState brewingStand) { +// super(player, PrimarySkillType.ALCHEMY); +// this.brewingStand = brewingStand; +// cancelled = false; +// } +// +// public boolean isCancelled() { +// return cancelled; +// } +// +// public void setCancelled(boolean newValue) { +// this.cancelled = newValue; +// } +// +// public Block getBrewingStandBlock() { +// return brewingStand.getBlock(); +// } +// +// public BrewingStand getBrewingStand() { +// return (BrewingStand) brewingStand; +// } +//} diff --git a/src/main/java/com/gmail/nossr50/dumpster/McMMOPlayerCatalysisEvent.java b/src/main/java/com/gmail/nossr50/dumpster/McMMOPlayerCatalysisEvent.java new file mode 100644 index 000000000..39b7ba369 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/dumpster/McMMOPlayerCatalysisEvent.java @@ -0,0 +1,34 @@ +//package com.gmail.nossr50.events.skills.alchemy; +// +//import com.gmail.nossr50.datatypes.skills.PrimarySkillType; +//import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent; +//import org.bukkit.entity.Player; +//import org.bukkit.event.Cancellable; +// +//public class McMMOPlayerCatalysisEvent extends McMMOPlayerSkillEvent implements Cancellable { +// private double speed; +// +// private boolean cancelled; +// +// public McMMOPlayerCatalysisEvent(Player player, double speed) { +// super(player, PrimarySkillType.ALCHEMY); +// this.speed = speed; +// cancelled = false; +// } +// +// public boolean isCancelled() { +// return cancelled; +// } +// +// public void setCancelled(boolean newValue) { +// this.cancelled = newValue; +// } +// +// public double getSpeed() { +// return speed; +// } +// +// public void setSpeed(double speed) { +// this.speed = speed; +// } +//} diff --git a/src/main/java/com/gmail/nossr50/events/skills/McMMOPlayerSkillEvent.java b/src/main/java/com/gmail/nossr50/events/skills/McMMOPlayerSkillEvent.java index c73d01f50..623ab0dd5 100644 --- a/src/main/java/com/gmail/nossr50/events/skills/McMMOPlayerSkillEvent.java +++ b/src/main/java/com/gmail/nossr50/events/skills/McMMOPlayerSkillEvent.java @@ -14,12 +14,10 @@ public abstract class McMMOPlayerSkillEvent extends PlayerEvent { **/ private static final HandlerList handlers = new HandlerList(); protected PrimarySkillType skill; - protected int skillLevel; protected McMMOPlayerSkillEvent(Player player, PrimarySkillType skill) { super(player); this.skill = skill; - this.skillLevel = pluginRef.getUserManager().getPlayer(player).getSkillLevel(skill); } public static HandlerList getHandlerList() { @@ -33,13 +31,6 @@ public abstract class McMMOPlayerSkillEvent extends PlayerEvent { return skill; } - /** - * @return The level of the skill involved in this event - */ - public int getSkillLevel() { - return skillLevel; - } - @Override public HandlerList getHandlers() { return handlers; diff --git a/src/main/java/com/gmail/nossr50/events/skills/alchemy/McMMOPlayerBrewEvent.java b/src/main/java/com/gmail/nossr50/events/skills/alchemy/McMMOPlayerBrewEvent.java deleted file mode 100644 index 1611fc178..000000000 --- a/src/main/java/com/gmail/nossr50/events/skills/alchemy/McMMOPlayerBrewEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gmail.nossr50.events.skills.alchemy; - -import com.gmail.nossr50.datatypes.skills.PrimarySkillType; -import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent; -import org.bukkit.block.Block; -import org.bukkit.block.BlockState; -import org.bukkit.block.BrewingStand; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; - -public class McMMOPlayerBrewEvent extends McMMOPlayerSkillEvent implements Cancellable { - private BlockState brewingStand; - - private boolean cancelled; - - public McMMOPlayerBrewEvent(Player player, BlockState brewingStand) { - super(player, PrimarySkillType.ALCHEMY); - this.brewingStand = brewingStand; - cancelled = false; - } - - public boolean isCancelled() { - return cancelled; - } - - public void setCancelled(boolean newValue) { - this.cancelled = newValue; - } - - public Block getBrewingStandBlock() { - return brewingStand.getBlock(); - } - - public BrewingStand getBrewingStand() { - return (BrewingStand) brewingStand; - } -} diff --git a/src/main/java/com/gmail/nossr50/events/skills/alchemy/McMMOPlayerCatalysisEvent.java b/src/main/java/com/gmail/nossr50/events/skills/alchemy/McMMOPlayerCatalysisEvent.java deleted file mode 100644 index c4dbcc7d3..000000000 --- a/src/main/java/com/gmail/nossr50/events/skills/alchemy/McMMOPlayerCatalysisEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.gmail.nossr50.events.skills.alchemy; - -import com.gmail.nossr50.datatypes.skills.PrimarySkillType; -import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; - -public class McMMOPlayerCatalysisEvent extends McMMOPlayerSkillEvent implements Cancellable { - private double speed; - - private boolean cancelled; - - public McMMOPlayerCatalysisEvent(Player player, double speed) { - super(player, PrimarySkillType.ALCHEMY); - this.speed = speed; - cancelled = false; - } - - public boolean isCancelled() { - return cancelled; - } - - public void setCancelled(boolean newValue) { - this.cancelled = newValue; - } - - public double getSpeed() { - return speed; - } - - public void setSpeed(double speed) { - this.speed = speed; - } -}