diff --git a/TheButtonAutoFlair.jar b/TheButtonAutoFlair.jar index 16f78cb..7bb1d5a 100644 Binary files a/TheButtonAutoFlair.jar and b/TheButtonAutoFlair.jar differ diff --git a/TheButtonAutoFlair/.classpath b/TheButtonAutoFlair/.classpath index 73de7ac..e914d4d 100644 --- a/TheButtonAutoFlair/.classpath +++ b/TheButtonAutoFlair/.classpath @@ -25,9 +25,12 @@ - + + + + diff --git a/TheButtonAutoFlair/plugin.yml b/TheButtonAutoFlair/plugin.yml index f68f6c7..5a2f769 100644 --- a/TheButtonAutoFlair/plugin.yml +++ b/TheButtonAutoFlair/plugin.yml @@ -19,8 +19,10 @@ commands: description: Search the wiki. usage: "&vUsage: /mwiki [query]&r" dontrunthiscmd: + warmode: + description: Toggles war mode author: NorbiPeti -depend: [Essentials, Towny, Minigames, Votifier, Factions] +depend: [Essentials, Towny, Minigames, Votifier, Factions, WorldGuard, WorldEdit, OreRegenerator] permissions: tbmc.admin: description: Gives access to /un- commands and /u admin commands diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java index 7ff676a..831ee17 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java @@ -1,5 +1,7 @@ package tk.sznp.thebuttonautoflair; +import me.steffansk1997.OreRegenerator.OreRegenerator; + import org.apache.commons.io.FileUtils; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -17,6 +19,10 @@ import org.bukkit.potion.PotionEffectType; import com.earth2me.essentials.Mob; import com.earth2me.essentials.Mob.MobException; +import com.sk89q.worldguard.bukkit.WorldGuardPlugin; +import com.sk89q.worldguard.protection.ApplicableRegionSet; +import com.sk89q.worldguard.protection.flags.StateFlag; +import com.sk89q.worldguard.protection.regions.ProtectedRegion; import au.com.mineauz.minigames.MinigamePlayer; import au.com.mineauz.minigames.Minigames; @@ -255,6 +261,27 @@ public class Commands implements CommandExecutor { DoMWiki(player, args); return true; } + case "warmode": { + ApplicableRegionSet ars = ((WorldGuardPlugin) Bukkit + .getPluginManager().getPlugin("WorldGuard")) + .getRegionManager(player.getWorld()) + .getApplicableRegions(player.getLocation()); + for (ProtectedRegion pr : ars) { + if (pr.getFlag(OreRegenerator.FLAG_REGENORES) == StateFlag.State.ALLOW) { + pr.setFlag(OreRegenerator.FLAG_REGENORES, + StateFlag.State.DENY); + sender.sendMessage("§eWarmode §cdisabled §ein " + + pr.getId()); + } else { + pr.setFlag(OreRegenerator.FLAG_REGENORES, + StateFlag.State.ALLOW); + sender.sendMessage("§eWarmode §aenabled §ein " + + pr.getId()); + } + break; + } + return true; + } default: player.sendMessage("Unknown command: " + cmd.getName()); break; diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java index 730c1ca..cc86101 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java @@ -547,9 +547,13 @@ public class PlayerListener implements Listener { System.out.println("Vote: " + vote); org.bukkit.OfflinePlayer op = Bukkit.getOfflinePlayer(vote .getUsername()); + Player p = Bukkit.getPlayer(vote.getUsername()); if (op != null) { PluginMain.economy.depositPlayer(op, 50.0); } + if (p != null) { + p.sendMessage("§bThanks for voting! $50 was added to your account."); + } } /* diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java index e799f0a..1a3e357 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PluginMain.java @@ -1,5 +1,6 @@ package tk.sznp.thebuttonautoflair; +import me.steffansk1997.OreRegenerator.OreRegenerator; import net.milkbowl.vault.chat.Chat; import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.permission.Permission; @@ -24,6 +25,8 @@ import com.palmergames.bukkit.towny.Towny; import com.palmergames.bukkit.towny.object.Nation; import com.palmergames.bukkit.towny.object.Town; import com.palmergames.bukkit.towny.object.TownyUniverse; +import com.sk89q.worldguard.bukkit.WorldGuardPlugin; +import com.sk89q.worldguard.protection.flags.StateFlag; import java.io.*; import java.lang.String; @@ -94,6 +97,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. this.getCommand("mwiki").setExecutor(comm); this.getCommand("mwiki").setUsage( this.getCommand("mwiki").getUsage().replace('&', '§')); + this.getCommand("warmode").setExecutor(comm); Instance = this; // 2015.08.08. Console = this.getServer().getConsoleSender(); // 2015.08.12. LoadFiles(false); // 2015.08.09. @@ -119,6 +123,11 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. GameMechanics.addGameMechanic(new CreativeGlobalMechanic()); + ((WorldGuardPlugin) Bukkit.getPluginManager().getPlugin("WorldGuard")) + .getRegionManager(Bukkit.getWorlds().get(0)) + .getRegion("__global__") + .setFlag(OreRegenerator.FLAG_REGENORES, StateFlag.State.DENY); + Runnable r = new Runnable() { public void run() { ThreadMethod(); diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$1.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$1.class index 50dc676..b1ab2c4 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$1.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$1.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$2.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$2.class index 9ce2e2a..6e3964d 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$2.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$2.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands.class index e2ba29f..f94f88c 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$4.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$4.class index eda06e8..2163a4b 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$4.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$4.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class index f9d91d2..9226ccc 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$1.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$1.class index 85e6cef..8acb477 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$1.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$1.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$2.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$2.class index 7640c00..9cfa7ea 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$2.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain$2.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class index ccf160d..b0b1f25 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PluginMain.class differ