@@ -69,15 +69,15 @@ public Prompt acceptInput(ConversationContext context, String input) {
6969 NormalFastInv pagedGui = new BasePage (9 , setupInventory .getPlugin ().getPluginMessagePrefix () + "Base Editor Menu" , setupInventory );
7070 pagedGui .open (setupInventory .getPlayer ());
7171 return Prompt .END_OF_CONVERSATION ;
72- } catch (IllegalArgumentException ignored ) {
72+ } catch (IllegalArgumentException ignored ) {
7373 context .getForWhom ().sendRawMessage (new MessageBuilder ("&cTry again. This is not an color!" ).prefix ().build ());
7474 return Prompt .END_OF_CONVERSATION ;
7575 }
7676 }
7777 }).buildFor ((Player ) event .getWhoClicked ());
7878 }));
7979
80- LocationSelectorItem baseCorners = new LocationSelectorItem (setupInventory , new ItemBuilder (XMaterial .BEDROCK .parseMaterial ()), "Base" , "Set the corners of one base" , "bases." + getId (setupInventory .getPlayer ()) + ".baselocation" );
80+ LocationSelectorItem baseCorners = new LocationSelectorItem (setupInventory , new ItemBuilder (XMaterial .BEDROCK .parseMaterial ()), "Base" , "Set the corners of one base" , "bases." + getId (setupInventory .getPlayer ()) + ".baselocation" );
8181 setItem (1 , baseCorners );
8282
8383 //portal in mid function? LocationSerializer.saveLoc(setupInventory.getPlugin(), setupInventory.getConfig(), "arenas", "instances." + setupInventory.getArenaKey() + ".bases." + getId(setupInventory.getPlayer()) + ".portalhologram", new Cuboid(selection.getFirstPos(), selection.getSecondPos()).getCenter().add(0, 2, 0));
@@ -103,30 +103,41 @@ public Prompt acceptInput(ConversationContext context, String input) {
103103 .lore (ChatColor .GREEN + "Click to finish & save the setup of this base" )
104104 .build (), event -> {
105105 String path = "instances." + setupInventory .getArenaKey () + ".bases." + getId (setupInventory .getPlayer ());
106- if (setupInventory .getConfig ().get (path + ".baselocation.1" ) == null ) {
106+ if (setupInventory .getConfig ().get (path + ".baselocation.1" ) == null ) {
107107 new MessageBuilder ("&c&l✘ &cBase validation failed! Please configure base location properly!" ).prefix ().player (setupInventory .getPlayer ()).sendPlayer ();
108108 return ;
109109 }
110- if (setupInventory .getConfig ().get (path + ".portallocation.1" ) == null ) {
110+ if (setupInventory .getConfig ().get (path + ".portallocation.1" ) == null ) {
111111 new MessageBuilder ("&c&l✘ &cBase validation failed! Please configure portal location properly!" ).prefix ().player (setupInventory .getPlayer ()).sendPlayer ();
112112 return ;
113113 }
114- if (setupInventory .getConfig ().get (path + ".spawnpoint" ) == null ) {
114+ if (setupInventory .getConfig ().get (path + ".spawnpoint" ) == null ) {
115115 new MessageBuilder ("&c&l✘ &cBase validation failed! Please configure spawnpoint properly!" ).prefix ().player (setupInventory .getPlayer ()).sendPlayer ();
116116 return ;
117117 }
118- if (setupInventory .getConfig ().get (path + ".respawnpoint" ) == null ) {
118+ if (setupInventory .getConfig ().get (path + ".respawnpoint" ) == null ) {
119119 new MessageBuilder ("&c&l✘ &cBase validation failed! Please configure respawnpoint properly!" ).prefix ().player (setupInventory .getPlayer ()).sendPlayer ();
120120 return ;
121121 }
122- if (setupInventory .getConfig ().get (path + ".color" ) == null ) {
122+ if (setupInventory .getConfig ().get (path + ".color" ) == null ) {
123123 new MessageBuilder ("&c&l✘ &cBase validation failed! Please configure color properly!" ).prefix ().player (setupInventory .getPlayer ()).sendPlayer ();
124124 return ;
125125 }
126- if (setupInventory .getConfig ().get (path + ".portalhologram" ) == null ) {
126+ if (setupInventory .getConfig ().get (path + ".portalhologram" ) == null ) {
127127 new MessageBuilder ("&c&l✘ &cBase validation failed! Please configure portalhologram properly!" ).prefix ().player (setupInventory .getPlayer ()).sendPlayer ();
128128 return ;
129129 }
130+ if (setupInventory .getConfig ().get (path + ".portalhologram" ) == null ) {
131+ new MessageBuilder ("&c&l✘ &cBase validation failed! Please configure portalhologram properly!" ).prefix ().player (setupInventory .getPlayer ()).sendPlayer ();
132+ return ;
133+ }
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" )));
136+ 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 ();
138+ return ;
139+ }
140+ }
130141 new MessageBuilder ("&a&l✔ &aValidation succeeded! Registering new base: " + getId (setupInventory .getPlayer ())).prefix ().player (setupInventory .getPlayer ()).sendPlayer ();
131142 setupInventory .setConfig ("bases." + getId (setupInventory .getPlayer ()) + ".isdone" , true );
132143 Base base = new Base (
@@ -139,13 +150,13 @@ public Prompt acceptInput(ConversationContext context, String input) {
139150 LocationSerializer .getLocation (setupInventory .getConfig ().getString (path + ".portallocation.2" )),
140151 setupInventory .getConfig ().getInt (path + ".maximumsize" )
141152 );
142- if (setupInventory .getConfig ().get (path + ".cagelocation.1" ) != null && setupInventory .getConfig ().get (path + ".cagelocation.2" ) != null ) {
153+ if (setupInventory .getConfig ().get (path + ".cagelocation.1" ) != null && setupInventory .getConfig ().get (path + ".cagelocation.2" ) != null ) {
143154 base .setCageCuboid (new Cuboid (LocationSerializer .getLocation (setupInventory .getConfig ().getString (path + ".cagelocation.1" )), LocationSerializer .getLocation (setupInventory .getConfig ().getString (path + ".cagelocation.2" ))));
144155 }
145156 Arena arena = (Arena ) setupInventory .getPlugin ().getArenaRegistry ().getArena (setupInventory .getArenaKey ());
146157 arena .addBase (base );
147158 ArmorStandHologram portal = new ArmorStandHologram (setupInventory .getPlugin ().getBukkitHelper ().getBlockCenter (LocationSerializer .getLocation (setupInventory .getConfig ().getString (path + ".portalhologram" ))));
148- for (String str : setupInventory .getPlugin ().getLanguageManager ().getLanguageMessage (setupInventory .getPlugin ().getMessageManager ().getPath ("IN_GAME_MESSAGES_ARENA_PORTAL_HOLOGRAM" )).split (";" )) {
159+ for (String str : setupInventory .getPlugin ().getLanguageManager ().getLanguageMessage (setupInventory .getPlugin ().getMessageManager ().getPath ("IN_GAME_MESSAGES_ARENA_PORTAL_HOLOGRAM" )).split (";" )) {
149160 portal .appendLine (str .replace ("%arena_base_color_formatted%" , base .getFormattedColor ()));
150161 }
151162 base .setArmorStandHologram (portal );
@@ -167,14 +178,14 @@ String getPromptText(ConversationContext context) {
167178
168179 @ Override
169180 public Prompt acceptInput (ConversationContext context , String input ) {
170- if (!NumberUtils .isInteger (input )) {
181+ if (!NumberUtils .isInteger (input )) {
171182 context .getForWhom ().sendRawMessage (new MessageBuilder ("&cTry again. Its not a number!" ).prefix ().build ());
172183 return Prompt .END_OF_CONVERSATION ;
173184 }
174185 int number = Integer .parseInt (input );
175186
176- if (setupInventory .getConfig ().getConfigurationSection ("instances." + setupInventory .getArenaKey () + ".bases" ) != null ) {
177- if (number >= setupInventory .getConfig ().getConfigurationSection ("instances." + setupInventory .getArenaKey () + ".bases" ).getKeys (false ).size ()) {
187+ if (setupInventory .getConfig ().getConfigurationSection ("instances." + setupInventory .getArenaKey () + ".bases" ) != null ) {
188+ if (number >= setupInventory .getConfig ().getConfigurationSection ("instances." + setupInventory .getArenaKey () + ".bases" ).getKeys (false ).size ()) {
178189 context .getForWhom ().sendRawMessage (new MessageBuilder ("&cTry again. The number is higher than bases that you have!" ).prefix ().build ());
179190 return Prompt .END_OF_CONVERSATION ;
180191 }
@@ -195,9 +206,9 @@ public Prompt acceptInput(ConversationContext context, String input) {
195206
196207
197208 public int getId (Player player ) {
198- if (!BaseUtilities .check (player )) {
209+ if (!BaseUtilities .check (player )) {
199210 int id = 0 ;
200- if (setupInventory .getConfig ().getConfigurationSection ("instances." + setupInventory .getArenaKey () + ".bases" ) != null ) {
211+ if (setupInventory .getConfig ().getConfigurationSection ("instances." + setupInventory .getArenaKey () + ".bases" ) != null ) {
201212 id = setupInventory .getConfig ().getConfigurationSection ("instances." + setupInventory .getArenaKey () + ".bases" ).getKeys (false ).size ();
202213 }
203214 BaseUtilities .getBaseId ().put (player , id );
0 commit comments