mirror of
https://github.com/darksaid98/AlathranWars.git
synced 2026-12-01 14:38:55 +00:00
Cleaning and other stuff
This commit is contained in:
1 parent
65dc1c9846
commit
6b5000e26b
10 files changed
+36
-34
No files matched your search
@@ -116,9 +116,6 @@ public class Raid {
|
||||
} else {
|
||||
final Raid this$0 = Raid.this;
|
||||
Raid.access$7(this$0, this$0.raidTicks + 200);
|
||||
Main.raidData.getConfig().set("Raids." + String.valueOf(Raid.this.id) + ".raidticks",
|
||||
(Object) Raid.this.raidTicks);
|
||||
Main.raidData.saveConfig();
|
||||
|
||||
// Raid update
|
||||
if (Raid.this.raidTicks % 6000 == 0) {
|
||||
@@ -139,8 +136,6 @@ public class Raid {
|
||||
public void stop() {
|
||||
Bukkit.getScheduler().cancelTask(this.bukkitId[0]);
|
||||
RaidCommands.raids.remove(this); // im not making this rn -Aubri
|
||||
Main.raidData.getConfig().set("Raids." + String.valueOf(this.id), (Object) null);
|
||||
Main.raidData.saveConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,15 +24,14 @@ public class RaidCommands implements CommandExecutor
|
||||
static {
|
||||
RaidCommands.towns = new ArrayList<Town>();
|
||||
RaidCommands.raids = new ArrayList<Raid>();
|
||||
RaidCommands.maxID = Main.raidData.getConfig().getInt("MaxID");
|
||||
}
|
||||
|
||||
public RaidCommands(final Main plugin) {
|
||||
plugin.getCommand("raid").setExecutor((CommandExecutor)this);
|
||||
//plugin.getCommand("raid").setExecutor((CommandExecutor)this);
|
||||
}
|
||||
|
||||
public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
|
||||
final Player p = (Player)sender;
|
||||
/*final Player p = (Player)sender;
|
||||
if (args.length == 0) {
|
||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "Invalid Arguments. /raid help");
|
||||
}
|
||||
@@ -123,7 +122,7 @@ public class RaidCommands implements CommandExecutor
|
||||
for (final War war : WarCommands.wars) {
|
||||
if (war.getName().equalsIgnoreCase(args[1])) {
|
||||
warFound = true;
|
||||
if (!war.getSide1Players().contains(p.getName()) && !war.getSide2Players().contains(p.getName())) {
|
||||
/*if (!war.getSide1Players().contains(p.getName()) && !war.getSide2Players().contains(p.getName())) {
|
||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You are not in this war! Type /war join [war] [side]");
|
||||
}
|
||||
TownyWorld townyWorld;
|
||||
@@ -195,6 +194,7 @@ public class RaidCommands implements CommandExecutor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (attackingOwnSide) {
|
||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You cannot raid a town with members on your side of the war!");
|
||||
return false;
|
||||
@@ -253,7 +253,8 @@ public class RaidCommands implements CommandExecutor
|
||||
}
|
||||
else {
|
||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "Invalid Arguments. /raid help");
|
||||
}
|
||||
}*/
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ public class RaidTabCompletion implements TabCompleter {
|
||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
List<String> completions = new ArrayList<>();
|
||||
Player p = (Player)sender;
|
||||
/*
|
||||
if (args.length == 1) {
|
||||
if (p.hasPermission("AlathraWar.admin")) {
|
||||
completions.add("stop");
|
||||
@@ -54,6 +55,7 @@ public class RaidTabCompletion implements TabCompleter {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import me.ShermansWorld.AlathraWar.Helper;
|
||||
import me.ShermansWorld.AlathraWar.Main;
|
||||
import me.ShermansWorld.AlathraWar.Siege;
|
||||
import me.ShermansWorld.AlathraWar.War;
|
||||
import me.ShermansWorld.AlathraWar.data.WarData;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -22,13 +23,12 @@ import org.bukkit.command.CommandExecutor;
|
||||
public class SiegeCommands implements CommandExecutor
|
||||
{
|
||||
public static ArrayList<Town> towns;
|
||||
public static ArrayList<Siege> sieges;
|
||||
public static int maxID;
|
||||
|
||||
static {
|
||||
SiegeCommands.towns = new ArrayList<Town>();
|
||||
SiegeCommands.sieges = new ArrayList<Siege>();
|
||||
SiegeCommands.maxID = Main.siegeData.getConfig().getInt("MaxID");
|
||||
//SiegeCommands.sieges = new ArrayList<Siege>();
|
||||
//SiegeCommands.maxID = Main.siegeData.getConfig().getInt("MaxID");
|
||||
}
|
||||
|
||||
public SiegeCommands(final Main plugin) {
|
||||
@@ -39,7 +39,7 @@ public class SiegeCommands implements CommandExecutor
|
||||
final Player p = (Player)sender;
|
||||
if (args.length == 0) {
|
||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "Invalid Arguments. /siege help");
|
||||
}
|
||||
} /*
|
||||
else if (args.length == 1) {
|
||||
if (args[0].equalsIgnoreCase("list")) {
|
||||
if (SiegeCommands.sieges.isEmpty()) {
|
||||
@@ -125,10 +125,10 @@ public class SiegeCommands implements CommandExecutor
|
||||
if (args[0].equalsIgnoreCase("start")) {
|
||||
boolean warFound = false;
|
||||
boolean townExists = false;
|
||||
for (final War war : WarCommands.wars) {
|
||||
for (final War war : WarData.getWars()) {
|
||||
if (war.getName().equalsIgnoreCase(args[1])) {
|
||||
warFound = true;
|
||||
if (!war.getSide1Players().contains(p.getName()) && !war.getSide2Players().contains(p.getName())) {
|
||||
/*if (!war.getSide1Players().contains(p.getName()) && !war.getSide2Players().contains(p.getName())) {
|
||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You are not in this war! Type /war join [war] [side]");
|
||||
}
|
||||
TownyWorld townyWorld;
|
||||
@@ -146,7 +146,7 @@ public class SiegeCommands implements CommandExecutor
|
||||
Main.siegeData.getConfig().set("MaxID", (Object)SiegeCommands.maxID);
|
||||
Main.siegeData.saveConfig();
|
||||
Siege siege2;
|
||||
if (war.getSide1Players().contains(p.getName())) {
|
||||
/*if (war.getSide1Players().contains(p.getName())) {
|
||||
siege2 = new Siege(SiegeCommands.maxID, war, town, war.getSide1(), war.getSide2(), true, false);
|
||||
Main.siegeData.getConfig().set("Sieges." + String.valueOf(SiegeCommands.maxID) + ".war", (Object)war.getName());
|
||||
Main.siegeData.getConfig().set("Sieges." + String.valueOf(SiegeCommands.maxID) + ".town", (Object)town.getName());
|
||||
@@ -195,7 +195,7 @@ public class SiegeCommands implements CommandExecutor
|
||||
attackingOwnSide = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}//
|
||||
if (attackingOwnSide) {
|
||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You cannot siege a town with members on your side of the war!");
|
||||
return false;
|
||||
@@ -226,18 +226,19 @@ public class SiegeCommands implements CommandExecutor
|
||||
}
|
||||
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(p.getUniqueId());
|
||||
if (Main.econ.getBalance(offlinePlayer) <= 2500.0) {
|
||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You must have at least $20,000 to put up to start a siege");
|
||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You must have at least $2500 to put up to start a siege");
|
||||
Main.siegeData.getConfig().set("Sieges." + String.valueOf(SiegeCommands.maxID), (Object)null);
|
||||
Main.siegeData.saveConfig();
|
||||
return false;
|
||||
}
|
||||
Main.econ.withdrawPlayer(offlinePlayer, 2500.0);
|
||||
SiegeCommands.sieges.add(siege2);
|
||||
/*SiegeCommands.sieges.add(siege2);
|
||||
siege2.start();
|
||||
siege2.createBeacon();
|
||||
Bukkit.broadcastMessage(String.valueOf(Helper.Chatlabel()) + "As part of " + war.getName() + ", forces from " + siege2.getAttackers() + " are laying siege to the town of " + town.getName() + "!");
|
||||
Main.warLogger.log(p.getName() + " started a siege.");
|
||||
Main.warLogger.log("As part of " + war.getName() + ", forces from " + siege2.getAttackers() + " are laying siege to the town of " + town.getName() + "!");
|
||||
*
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -256,6 +257,7 @@ public class SiegeCommands implements CommandExecutor
|
||||
else {
|
||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "Invalid Arguments. /siege help");
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ public class SiegeTabCompletion implements TabCompleter {
|
||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
List<String> completions = new ArrayList<>();
|
||||
Player p = (Player)sender;
|
||||
/*
|
||||
if (args.length == 1) {
|
||||
if (p.hasPermission("AlathraWar.admin")) {
|
||||
completions.add("stop");
|
||||
@@ -55,7 +56,7 @@ public class SiegeTabCompletion implements TabCompleter {
|
||||
return completions;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,12 +34,6 @@ public class WarCommands implements CommandExecutor {
|
||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "Invalid Arguments. /war help");
|
||||
return true;
|
||||
} else if (args.length >= 1) {
|
||||
// Create - Admin Command
|
||||
// Delete - Admin Command
|
||||
// Join - Auto works out town/nation e.t.c.
|
||||
// Surrender - Auto works out town/nation e.t.c.
|
||||
// List - Lists all current wars
|
||||
// Info - Info on a player and their wars.
|
||||
|
||||
switch(args[0].toLowerCase()) {
|
||||
case "create":
|
||||
@@ -67,9 +61,7 @@ public class WarCommands implements CommandExecutor {
|
||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "Invalid Arguments. /war help");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package me.ShermansWorld.AlathraWar.data;
|
||||
|
||||
import me.ShermansWorld.AlathraWar.Main;
|
||||
import me.ShermansWorld.AlathraWar.War;
|
||||
|
||||
import org.bukkit.configuration.Configuration;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@@ -58,4 +60,8 @@ public class RaidData {
|
||||
this.plugin.saveResource("raids.yml", false);
|
||||
}
|
||||
}
|
||||
|
||||
public static Object getRaidMap(War war) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import org.bukkit.event.block.BlockBreakEvent;
|
||||
|
||||
import me.ShermansWorld.AlathraWar.Siege;
|
||||
import me.ShermansWorld.AlathraWar.commands.SiegeCommands;
|
||||
import me.ShermansWorld.AlathraWar.data.SiegeData;
|
||||
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
@@ -14,10 +15,10 @@ public class BlockBreakListener implements Listener
|
||||
@EventHandler
|
||||
public void onBlockBreak(final BlockBreakEvent event) {
|
||||
final Block block = event.getBlock();
|
||||
if (SiegeCommands.sieges.isEmpty()) {
|
||||
if (SiegeData.getSieges().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (final Siege siege : SiegeCommands.sieges) {
|
||||
for (final Siege siege : SiegeData.getSieges()) {
|
||||
if (siege.beaconLocs.contains(block.getLocation())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.palmergames.bukkit.towny.object.Town;
|
||||
import me.ShermansWorld.AlathraWar.Main;
|
||||
import me.ShermansWorld.AlathraWar.War;
|
||||
import me.ShermansWorld.AlathraWar.commands.WarCommands;
|
||||
import me.ShermansWorld.AlathraWar.data.WarData;
|
||||
import me.ShermansWorld.AlathraWar.hooks.TABHook;
|
||||
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -27,7 +28,7 @@ public class JoinListener implements Listener {
|
||||
if (town == null) return;
|
||||
String townName = town.getName();
|
||||
boolean inWar = false;
|
||||
for (final War war : WarCommands.wars) {
|
||||
for (final War war : WarData.getWars()) {
|
||||
if (war.getSide1Towns().contains(townName)) {
|
||||
TABHook.assignSide1WarSuffix(p, war);
|
||||
inWar = true;
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.palmergames.bukkit.towny.object.WorldCoord;
|
||||
import me.ShermansWorld.AlathraWar.Helper;
|
||||
import me.ShermansWorld.AlathraWar.Siege;
|
||||
import me.ShermansWorld.AlathraWar.commands.SiegeCommands;
|
||||
import me.ShermansWorld.AlathraWar.data.SiegeData;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
@@ -38,7 +39,7 @@ public final class KillsListener implements Listener
|
||||
catch (NotRegisteredException ex2) {}
|
||||
boolean playerCloseToHomeBlock = false;
|
||||
try {
|
||||
for (final Siege siege : SiegeCommands.sieges) {
|
||||
for (final Siege siege : SiegeData.getSieges()) {
|
||||
final int homeBlockXCoord = siege.getTown().getHomeBlock().getCoord().getX() * 16;
|
||||
final int homeBlockZCoord = siege.getTown().getHomeBlock().getCoord().getZ() * 16;
|
||||
if (Math.abs(killed.getLocation().getBlockX() - homeBlockXCoord) <= 300 && Math.abs(killed.getLocation().getBlockZ() - homeBlockZCoord) <= 300) {
|
||||
|
||||
Reference in new issue
Block a user