mirror of
https://github.com/darksaid98/AlathranWars.git
synced 2026-12-01 22:14:45 +00:00
Added siege capabilities
This commit is contained in:
1 parent
48915e7086
commit
65dc1c9846
4 files changed
+219
-239
No files matched your search
@@ -28,9 +28,6 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Main extends JavaPlugin {
|
||||
|
||||
public static WarData warData;
|
||||
public static SiegeData siegeData;
|
||||
public static RaidData raidData;
|
||||
public static Main instance;
|
||||
public static Economy econ;
|
||||
public static AlathraWarLogger warLogger;
|
||||
@@ -47,81 +44,6 @@ public class Main extends JavaPlugin {
|
||||
}
|
||||
|
||||
WarData.setWars(WarData.createWars());
|
||||
|
||||
try {
|
||||
Set<String> siegeSet = (Set<String>) siegeData.getConfig().getConfigurationSection("Sieges").getKeys(false);
|
||||
Iterator<String> it2 = siegeSet.iterator();
|
||||
ArrayList<String> siegesTempList = new ArrayList<String>();
|
||||
while (it2.hasNext()) {
|
||||
siegesTempList.add(it2.next());
|
||||
}
|
||||
for (int i = 0; i < siegesTempList.size(); ++i) {
|
||||
War siegeWar = null;
|
||||
Town siegeTown = null;
|
||||
for (final War war2 : WarCommands.wars) {
|
||||
if (siegeData.getConfig().getString("Sieges." + siegesTempList.get(i) + ".war")
|
||||
.equalsIgnoreCase(war2.getName())) {
|
||||
siegeWar = war2;
|
||||
}
|
||||
}
|
||||
List<Town> townList = TownyAPI.getInstance().getTowns();
|
||||
for (final Town town : townList) {
|
||||
if (town.getName().equalsIgnoreCase(
|
||||
siegeData.getConfig().getString("Sieges." + siegesTempList.get(i) + ".town"))) {
|
||||
siegeTown = town;
|
||||
}
|
||||
}
|
||||
Siege siege = new Siege(Integer.parseInt(siegesTempList.get(i)), siegeWar, siegeTown,
|
||||
siegeData.getConfig().getString("Sieges." + siegesTempList.get(i) + ".attackers"),
|
||||
siegeData.getConfig().getString("Sieges." + siegesTempList.get(i) + ".defenders"),
|
||||
siegeData.getConfig().getBoolean("Sieges." + siegesTempList.get(i) + ".siege1areattackers"),
|
||||
siegeData.getConfig().getBoolean("Sieges." + siegesTempList.get(i) + ".siege2areattackers"));
|
||||
SiegeCommands.sieges.add(siege);
|
||||
siege.start();
|
||||
siege.resetBeacon(
|
||||
Bukkit.getWorld(siegeData.getConfig().getString("Sieges." + siegesTempList.get(i) + ".world")),
|
||||
siegeData.getConfig().getInt("Sieges." + siegesTempList.get(i) + ".homeblockx"),
|
||||
siegeData.getConfig().getInt("Sieges." + siegesTempList.get(i) + ".homeblocky"),
|
||||
siegeData.getConfig().getInt("Sieges." + siegesTempList.get(i) + ".homeblockz"));
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
Bukkit.getLogger().info("NULL when initializing sieges");
|
||||
}
|
||||
|
||||
//TODO: Raids
|
||||
try {
|
||||
Set<String> raidSet = (Set<String>) raidData.getConfig().getConfigurationSection("Raids").getKeys(false);
|
||||
Iterator<String> it2 = raidSet.iterator();
|
||||
ArrayList<String> raidsTempList = new ArrayList<String>();
|
||||
while (it2.hasNext()) {
|
||||
raidsTempList.add(it2.next());
|
||||
}
|
||||
for (int i = 0; i < raidsTempList.size(); ++i) {
|
||||
War raidWar = null;
|
||||
Town raidTown = null;
|
||||
for (final War war2 : WarCommands.wars) {
|
||||
if (raidData.getConfig().getString("Raids." + raidsTempList.get(i) + ".war")
|
||||
.equalsIgnoreCase(war2.getName())) {
|
||||
raidWar = war2;
|
||||
}
|
||||
}
|
||||
List<Town> townList = TownyAPI.getInstance().getTowns();
|
||||
for (final Town town : townList) {
|
||||
if (town.getName().equalsIgnoreCase(
|
||||
siegeData.getConfig().getString("Raids." + raidsTempList.get(i) + ".town"))) {
|
||||
raidTown = town;
|
||||
}
|
||||
}
|
||||
Raid raid = new Raid(Integer.parseInt(raidsTempList.get(i)), raidWar, raidTown,
|
||||
siegeData.getConfig().getString("Raids." + raidsTempList.get(i) + ".raiders"),
|
||||
siegeData.getConfig().getString("Raids." + raidsTempList.get(i) + ".defenders"),
|
||||
siegeData.getConfig().getBoolean("Raids." + raidsTempList.get(i) + ".side1areraiders"),
|
||||
siegeData.getConfig().getBoolean("Raids." + raidsTempList.get(i) + ".side2areraiders"));
|
||||
raid.start();
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
Bukkit.getLogger().info("NULL when initializing raids");
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@@ -166,22 +88,21 @@ public class Main extends JavaPlugin {
|
||||
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
warData = new WarData(this);
|
||||
siegeData = new SiegeData(this);
|
||||
raidData = new RaidData(this);
|
||||
initLogs();
|
||||
|
||||
new WarData(this);
|
||||
new WarCommands(this);
|
||||
new SiegeCommands(this);
|
||||
new RaidCommands(this);
|
||||
getCommand("war").setTabCompleter(new WarTabCompletion());
|
||||
getCommand("siege").setTabCompleter(new SiegeTabCompletion());
|
||||
getCommand("raid").setTabCompleter(new RaidTabCompletion());
|
||||
//getCommand("raid").setTabCompleter(new RaidTabCompletion());
|
||||
getServer().getPluginManager().registerEvents((Listener) new KillsListener(), (Plugin) this);
|
||||
getServer().getPluginManager().registerEvents((Listener) new JoinListener(), (Plugin) this);
|
||||
getServer().getPluginManager().registerEvents((Listener) new BlockBreakListener(), (Plugin) this);
|
||||
initData();
|
||||
initAPIs();
|
||||
setupEconomy();
|
||||
initLogs();
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
|
||||
Reference in new issue
Block a user