mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2026-10-25 13:30:37 +00:00
command setup blueprint
This commit is contained in:
1 parent
96c0999ba7
commit
7f52c5a481
3 files changed
+44
-43
No files matched your search
@@ -7,10 +7,10 @@ public enum RTPCommandType {
|
|||||||
EDIT(new CmdEdit()),
|
EDIT(new CmdEdit()),
|
||||||
HELP(new CmdHelp()),
|
HELP(new CmdHelp()),
|
||||||
INFO(new CmdInfo()),
|
INFO(new CmdInfo()),
|
||||||
|
LOCATION(new CmdLocation()),
|
||||||
PLAYER(new CmdPlayer()),
|
PLAYER(new CmdPlayer()),
|
||||||
QUEUE(new CmdQueue(), true),
|
QUEUE(new CmdQueue(), true),
|
||||||
RELOAD(new CmdReload()),
|
RELOAD(new CmdReload()),
|
||||||
LOCATION(new CmdLocation()),
|
|
||||||
//SETTINGS(new CmdSettings(), true),
|
//SETTINGS(new CmdSettings(), true),
|
||||||
TEST(new CmdTest(), true),
|
TEST(new CmdTest(), true),
|
||||||
VERSION(new CmdVersion()),
|
VERSION(new CmdVersion()),
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -55,7 +56,7 @@ public interface FileData {
|
|||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
if (getConfig().isList(path)) list.addAll(getStringList(path));
|
if (getConfig().isList(path)) list.addAll(getStringList(path));
|
||||||
else if (getConfig().isString(path)) list.add(getString(path));
|
else if (getConfig().isString(path)) list.add(getString(path));
|
||||||
else return List.of("&7The path &e" + path + " &7was not configured correctly!");
|
else return new ArrayList<>(Collections.singleton("&7The path &e" + path + " &7was not configured correctly!"));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+41
-41
@@ -37,12 +37,12 @@ public class WorldLocation implements RTPWorld, RTPWorld_Defaulted {
|
|||||||
String key = entry.getKey().toString();
|
String key = entry.getKey().toString();
|
||||||
if (!key.equals(location_name))
|
if (!key.equals(location_name))
|
||||||
continue;
|
continue;
|
||||||
Map<?, ?> test = ((Map<?, ?>) m.get(key));
|
Map<?, ?> section = ((Map<?, ?>) m.get(key));
|
||||||
if (test == null)
|
if (section == null)
|
||||||
continue;
|
continue;
|
||||||
if (test.get("World") != null) {
|
if (section.get("World") != null) {
|
||||||
if (test.get("World").getClass() == String.class) {
|
if (section.get("World").getClass() == String.class) {
|
||||||
world = Bukkit.getWorld(test.get("World").toString());
|
world = Bukkit.getWorld(section.get("World").toString());
|
||||||
BetterRTP.debug("- - World: " + world.getName());
|
BetterRTP.debug("- - World: " + world.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,27 +50,27 @@ public class WorldLocation implements RTPWorld, RTPWorld_Defaulted {
|
|||||||
BetterRTP.getInstance().getLogger().warning("Location `" + location_name + "` does NOT have a `World` or world doesnt exist!");
|
BetterRTP.getInstance().getLogger().warning("Location `" + location_name + "` does NOT have a `World` or world doesnt exist!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (test.get("UseWorldBorder") != null) {
|
if (section.get("UseWorldBorder") != null) {
|
||||||
if (test.get("UseWorldBorder").getClass() == Boolean.class) {
|
if (section.get("UseWorldBorder").getClass() == Boolean.class) {
|
||||||
useWorldborder = Boolean.parseBoolean(test.get("UseWorldBorder").toString());
|
useWorldborder = Boolean.parseBoolean(section.get("UseWorldBorder").toString());
|
||||||
BetterRTP.debug("- - UseWorldBorder: " + useWorldborder);
|
BetterRTP.debug("- - UseWorldBorder: " + useWorldborder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (test.get("CenterX") != null) {
|
if (section.get("CenterX") != null) {
|
||||||
if (test.get("CenterX").getClass() == Integer.class) {
|
if (section.get("CenterX").getClass() == Integer.class) {
|
||||||
centerX = Integer.parseInt((test.get("CenterX")).toString());
|
centerX = Integer.parseInt((section.get("CenterX")).toString());
|
||||||
BetterRTP.debug("- - World: " + centerX);
|
BetterRTP.debug("- - World: " + centerX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (test.get("CenterZ") != null) {
|
if (section.get("CenterZ") != null) {
|
||||||
if (test.get("CenterZ").getClass() == Integer.class) {
|
if (section.get("CenterZ").getClass() == Integer.class) {
|
||||||
centerZ = Integer.parseInt((test.get("CenterZ")).toString());
|
centerZ = Integer.parseInt((section.get("CenterZ")).toString());
|
||||||
BetterRTP.debug("- - CenterZ: " + centerZ);
|
BetterRTP.debug("- - CenterZ: " + centerZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (test.get("MaxRadius") != null) {
|
if (section.get("MaxRadius") != null) {
|
||||||
if (test.get("MaxRadius").getClass() == Integer.class)
|
if (section.get("MaxRadius").getClass() == Integer.class)
|
||||||
maxRad = Integer.parseInt((test.get("MaxRadius")).toString());
|
maxRad = Integer.parseInt((section.get("MaxRadius")).toString());
|
||||||
if (maxRad <= 0) {
|
if (maxRad <= 0) {
|
||||||
Message_RTP.sms(Bukkit.getConsoleSender(),
|
Message_RTP.sms(Bukkit.getConsoleSender(),
|
||||||
"WARNING! Location '" + location_name + "' Maximum radius of '" + maxRad + "' is not allowed! Set to default value!");
|
"WARNING! Location '" + location_name + "' Maximum radius of '" + maxRad + "' is not allowed! Set to default value!");
|
||||||
@@ -78,9 +78,9 @@ public class WorldLocation implements RTPWorld, RTPWorld_Defaulted {
|
|||||||
}
|
}
|
||||||
BetterRTP.debug("- - MaxRadius: " + maxRad);
|
BetterRTP.debug("- - MaxRadius: " + maxRad);
|
||||||
}
|
}
|
||||||
if (test.get("MinRadius") != null) {
|
if (section.get("MinRadius") != null) {
|
||||||
if (test.get("MinRadius").getClass() == Integer.class)
|
if (section.get("MinRadius").getClass() == Integer.class)
|
||||||
minRad = Integer.parseInt((test.get("MinRadius")).toString());
|
minRad = Integer.parseInt((section.get("MinRadius")).toString());
|
||||||
if (minRad < 0 || minRad >= maxRad) {
|
if (minRad < 0 || minRad >= maxRad) {
|
||||||
Message_RTP.sms(Bukkit.getConsoleSender(),
|
Message_RTP.sms(Bukkit.getConsoleSender(),
|
||||||
"WARNING! Location '" + location_name + "' Minimum radius of '" + minRad + "' is not allowed! Set to default value!");
|
"WARNING! Location '" + location_name + "' Minimum radius of '" + minRad + "' is not allowed! Set to default value!");
|
||||||
@@ -92,55 +92,55 @@ public class WorldLocation implements RTPWorld, RTPWorld_Defaulted {
|
|||||||
}
|
}
|
||||||
BetterRTP.debug("- - MinRad: " + minRad);
|
BetterRTP.debug("- - MinRad: " + minRad);
|
||||||
}
|
}
|
||||||
if (test.get("Biomes") != null) {
|
if (section.get("Biomes") != null) {
|
||||||
if (test.get("Biomes").getClass() == ArrayList.class) {
|
if (section.get("Biomes").getClass() == ArrayList.class) {
|
||||||
this.biomes = new ArrayList<String>((ArrayList) test.get("Biomes"));
|
this.biomes = new ArrayList<String>((ArrayList) section.get("Biomes"));
|
||||||
BetterRTP.debug("- - Biomes: " + this.biomes);
|
BetterRTP.debug("- - Biomes: " + this.biomes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (BetterRTP.getInstance().getFiles().getType(FileOther.FILETYPE.ECO).getBoolean("Economy.Enabled"))
|
if (BetterRTP.getInstance().getFiles().getType(FileOther.FILETYPE.ECO).getBoolean("Economy.Enabled"))
|
||||||
if (test.get("Price") != null) {
|
if (section.get("Price") != null) {
|
||||||
if (test.get("Price").getClass() == Integer.class) {
|
if (section.get("Price").getClass() == Integer.class) {
|
||||||
this.price = Integer.parseInt(test.get("Price").toString());
|
this.price = Integer.parseInt(section.get("Price").toString());
|
||||||
BetterRTP.debug("- - Price: " + price);
|
BetterRTP.debug("- - Price: " + price);
|
||||||
}
|
}
|
||||||
//else
|
//else
|
||||||
// price = worldDefault.getPrice(world);
|
// price = worldDefault.getPrice(world);
|
||||||
} //else
|
} //else
|
||||||
//price = worldDefault.getPrice(world);
|
//price = worldDefault.getPrice(world);
|
||||||
if (test.get("Shape") != null) {
|
if (section.get("Shape") != null) {
|
||||||
if (test.get("Shape").getClass() == String.class) {
|
if (section.get("Shape").getClass() == String.class) {
|
||||||
try {
|
try {
|
||||||
this.shape = RTP_SHAPE.valueOf(test.get("Shape").toString().toUpperCase());
|
this.shape = RTP_SHAPE.valueOf(section.get("Shape").toString().toUpperCase());
|
||||||
BetterRTP.debug("- - Shape: " + shape.name());
|
BetterRTP.debug("- - Shape: " + shape.name());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//Invalid shape
|
//Invalid shape
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (test.get("UseWorldBorder") != null) {
|
if (section.get("UseWorldBorder") != null) {
|
||||||
if (test.get("UseWorldBorder").getClass() == Boolean.class) {
|
if (section.get("UseWorldBorder").getClass() == Boolean.class) {
|
||||||
try {
|
try {
|
||||||
this.useWorldborder = Boolean.parseBoolean(test.get("UseWorldBorder").toString());
|
this.useWorldborder = Boolean.parseBoolean(section.get("UseWorldBorder").toString());
|
||||||
BetterRTP.debug("- - UseWorldBorder: " + useWorldborder);
|
BetterRTP.debug("- - UseWorldBorder: " + useWorldborder);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//No UseWorldBorder
|
//No UseWorldBorder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (test.get("MinY") != null)
|
if (section.get("MinY") != null)
|
||||||
if (test.get("MinY").getClass() == Integer.class) {
|
if (section.get("MinY").getClass() == Integer.class) {
|
||||||
this.miny = Integer.parseInt(test.get("MinY").toString());
|
this.miny = Integer.parseInt(section.get("MinY").toString());
|
||||||
BetterRTP.debug("- - MinY: " + miny);
|
BetterRTP.debug("- - MinY: " + miny);
|
||||||
}
|
}
|
||||||
if (test.get("MaxY") != null)
|
if (section.get("MaxY") != null)
|
||||||
if (test.get("MaxY").getClass() == Integer.class) {
|
if (section.get("MaxY").getClass() == Integer.class) {
|
||||||
this.maxy = Integer.parseInt(test.get("MaxY").toString());
|
this.maxy = Integer.parseInt(section.get("MaxY").toString());
|
||||||
BetterRTP.debug("- - MaxY: " + maxy);
|
BetterRTP.debug("- - MaxY: " + maxy);
|
||||||
}
|
}
|
||||||
if (test.get("Cooldown") != null)
|
if (section.get("Cooldown") != null)
|
||||||
if (test.get("Cooldown").getClass() == Integer.class || test.get("Cooldown").getClass() == Long.class) {
|
if (section.get("Cooldown").getClass() == Integer.class || section.get("Cooldown").getClass() == Long.class) {
|
||||||
this.cooldown = Long.parseLong(test.get("Cooldown").toString());
|
this.cooldown = Long.parseLong(section.get("Cooldown").toString());
|
||||||
BetterRTP.debug("- - Cooldown: " + cooldown);
|
BetterRTP.debug("- - Cooldown: " + cooldown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user