Skip to content

Commit 159ac65

Browse files
committed
Added more information for arena cuboid setup
1 parent a48982a commit 159ac65

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

src/main/java/plugily/projects/thebridge/handlers/setup/LocationCategory.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@
2020

2121
package plugily.projects.thebridge.handlers.setup;
2222

23+
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
2324
import plugily.projects.minigamesbox.classic.handlers.setup.categories.PluginLocationCategory;
2425
import plugily.projects.minigamesbox.classic.handlers.setup.items.category.LocationItem;
2526
import plugily.projects.minigamesbox.classic.handlers.setup.items.category.LocationSelectorItem;
27+
import plugily.projects.minigamesbox.classic.utils.dimensional.Cuboid;
2628
import plugily.projects.minigamesbox.classic.utils.helper.ItemBuilder;
29+
import plugily.projects.minigamesbox.classic.utils.serialization.LocationSerializer;
2730
import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial;
2831
import plugily.projects.minigamesbox.inventory.normal.NormalFastInv;
2932

@@ -42,7 +45,19 @@ public void addItems(NormalFastInv gui) {
4245
gui.setItem((getInventoryLine() * 9) + 4, midLocation);
4346
getItemList().add(midLocation);
4447

45-
LocationSelectorItem arenaBorder = new LocationSelectorItem(getSetupInventory(), new ItemBuilder(XMaterial.BEDROCK.parseMaterial()), "Arena", "Location where all bases and lines are in \n (players will be able to build inside) \n MAKE SURE TO SET IT OUTSIDE \n OF THE BASES WHICH YOU SET BEFORE!", "arenalocation");
48+
LocationSelectorItem arenaBorder = new LocationSelectorItem(getSetupInventory(), new ItemBuilder(XMaterial.BEDROCK.parseMaterial()), "Arena Cuboid/Border", "Location where all bases and lines are in \n (players will be able to build inside) \n MAKE SURE TO SET IT OUTSIDE \n OF THE BASES (Baselocations) WHICH YOU SET BEFORE!", "arenalocation", inventoryClickEvent -> {
49+
String path = "instances." + getSetupInventory().getArenaKey();
50+
if(getSetupInventory().getConfig().getString(path + ".arenalocation.1") != null && getSetupInventory().getConfig().getString(path + ".arenalocation.2") != null) {
51+
Cuboid arenaCuboid = new Cuboid(LocationSerializer.getLocation(getSetupInventory().getConfig().getString(path + ".arenalocation.1", "world,364.0,63.0,-72.0,0.0,0.0")), LocationSerializer.getLocation(getSetupInventory().getConfig().getString(path + ".arenalocation.2", "world,364.0,63.0,-72.0,0.0,0.0")));
52+
for(String bases : getSetupInventory().getConfig().getConfigurationSection("instances." + getSetupInventory().getArenaKey() + ".bases").getKeys(false)) {
53+
if(getSetupInventory().getConfig().getString(path + "." + bases + ".baselocation.1") != null && getSetupInventory().getConfig().getString(path + "." + bases + ".baselocation.2") != null) {
54+
if(!(arenaCuboid.isIn(LocationSerializer.getLocation(getSetupInventory().getConfig().getString(path + "." + bases + ".baselocation.1"))) && arenaCuboid.isIn(LocationSerializer.getLocation(getSetupInventory().getConfig().getString(path + "." + bases + ".baselocation.2"))))) {
55+
new MessageBuilder("&c&l✘ &cArena validation failed! Please set your arena cuboids outside your base cuboids! The arena needs to be bigger than your bases locations! The following base is not inside the arena cuboid: " + bases).prefix().player(getSetupInventory().getPlayer()).sendPlayer();
56+
}
57+
}
58+
}
59+
}
60+
});
4661
gui.setItem((getInventoryLine() * 9) + 5, arenaBorder);
4762
getItemList().add(arenaBorder);
4863
}

src/main/java/plugily/projects/thebridge/handlers/setup/components/BasePage.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ public Prompt acceptInput(ConversationContext context, String input) {
131131
new MessageBuilder("&c&l✘ &cBase validation failed! Please configure portalhologram properly!").prefix().player(setupInventory.getPlayer()).sendPlayer();
132132
return;
133133
}
134-
if(setupInventory.getConfig().getString(path + ".arenalocation.1") != null && setupInventory.getConfig().getString(path + ".arenalocation.2") != null) {
135-
Cuboid arenaBorder = new Cuboid(LocationSerializer.getLocation(setupInventory.getConfig().getString(path + ".arenalocation.1", "world,364.0,63.0,-72.0,0.0,0.0")), LocationSerializer.getLocation(setupInventory.getConfig().getString(path + ".arenalocation.2", "world,364.0,63.0,-72.0,0.0,0.0")));
134+
if(setupInventory.getConfig().getString("instances." + setupInventory.getArenaKey() + ".arenalocation.1") != null && setupInventory.getConfig().getString("instances." + setupInventory.getArenaKey() + ".arenalocation.2") != null) {
135+
Cuboid arenaBorder = new Cuboid(LocationSerializer.getLocation(setupInventory.getConfig().getString("instances." + setupInventory.getArenaKey() + ".arenalocation.1", "world,364.0,63.0,-72.0,0.0,0.0")), LocationSerializer.getLocation(setupInventory.getConfig().getString("instances." + setupInventory.getArenaKey() + ".arenalocation.2", "world,364.0,63.0,-72.0,0.0,0.0")));
136136
if(!(arenaBorder.isIn(LocationSerializer.getLocation(setupInventory.getConfig().getString(path + ".baselocation.1"))) && arenaBorder.isIn(LocationSerializer.getLocation(setupInventory.getConfig().getString(path + ".baselocation.2"))))) {
137-
new MessageBuilder("&c&l✘ &cBase validation failed! Please set your base cuboids (baselocation.1 and baselocation.2) inside your arena cuboid!").prefix().player(setupInventory.getPlayer()).sendPlayer();
137+
new MessageBuilder("&c&l✘ &cBase validation failed! Please set your base cuboids (baselocation.1 and baselocation.2) inside your arena cuboid (Main Setup Menu of Arena -> Arena)!").prefix().player(setupInventory.getPlayer()).sendPlayer();
138138
return;
139139
}
140140
}

0 commit comments

Comments
 (0)