mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Schematic Support++
This commit is contained in:
parent
aa0d97eb2d
commit
c5195fc198
@ -1,9 +1,10 @@
|
|||||||
package com.intellectualcrafters.plot;
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the PlotWorld class (obviously)
|
* This is the PlotWorld class (obviously)
|
||||||
* <br> - All existing PlotWorld instances should be kept in PlotMain (worlds variable)
|
* <br> - All existing PlotWorld instances should be kept in PlotMain (worlds variable)
|
||||||
@ -190,6 +191,9 @@ public class PlotWorld {
|
|||||||
* Default schematic on claim: false
|
* Default schematic on claim: false
|
||||||
*/
|
*/
|
||||||
public static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false;
|
public static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false;
|
||||||
|
public boolean SCHEMATIC_CLAIM_SPECIFY = false;
|
||||||
|
public List<String> SCHEMATICS = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* schematic file
|
* schematic file
|
||||||
*/
|
*/
|
||||||
|
@ -89,7 +89,8 @@ public class WorldGenerator extends ChunkGenerator {
|
|||||||
options.put("worlds." + world + ".schematic.on_claim", SCHEMATIC_ON_CLAIM_DEFAULT);
|
options.put("worlds." + world + ".schematic.on_claim", SCHEMATIC_ON_CLAIM_DEFAULT);
|
||||||
options.put("worlds." + world + ".schematic.file", SCHEMATIC_FILE_DEFAULT);
|
options.put("worlds." + world + ".schematic.file", SCHEMATIC_FILE_DEFAULT);
|
||||||
options.put("worlds." + world + ".flags.default", DEFAULT_FLAGS_DEFAULT);
|
options.put("worlds." + world + ".flags.default", DEFAULT_FLAGS_DEFAULT);
|
||||||
|
options.put("worlds." + world + ".schematic.schematics", plotworld.SCHEMATICS);
|
||||||
|
options.put("worlds." + world + ".schematic.specify_on_claim", plotworld.SCHEMATIC_CLAIM_SPECIFY);
|
||||||
for (Entry<String, Object> node : options.entrySet()) {
|
for (Entry<String, Object> node : options.entrySet()) {
|
||||||
if (!config.contains(node.getKey())) {
|
if (!config.contains(node.getKey())) {
|
||||||
config.set(node.getKey(), node.getValue());
|
config.set(node.getKey(), node.getValue());
|
||||||
@ -116,6 +117,8 @@ public class WorldGenerator extends ChunkGenerator {
|
|||||||
this.plotworld.PLOT_CHAT = config.getBoolean("worlds." + world + ".plot_chat");
|
this.plotworld.PLOT_CHAT = config.getBoolean("worlds." + world + ".plot_chat");
|
||||||
this.plotworld.SCHEMATIC_ON_CLAIM = config.getBoolean("worlds." + world + ".schematic.on_claim");
|
this.plotworld.SCHEMATIC_ON_CLAIM = config.getBoolean("worlds." + world + ".schematic.on_claim");
|
||||||
this.plotworld.SCHEMATIC_FILE = config.getString("worlds." + world + ".schematic.file");
|
this.plotworld.SCHEMATIC_FILE = config.getString("worlds." + world + ".schematic.file");
|
||||||
|
this.plotworld.SCHEMATIC_CLAIM_SPECIFY = config.getBoolean("worlds." + world + ".schematic.specify_on_claim");
|
||||||
|
this.plotworld.SCHEMATICS = config.getStringList("worlds." + world + ".schematic.schematics");
|
||||||
|
|
||||||
String[] default_flags_string = config.getStringList("worlds." + world + ".flags.default").toArray(new String[0]);
|
String[] default_flags_string = config.getStringList("worlds." + world + ".flags.default").toArray(new String[0]);
|
||||||
Flag[] default_flags = new Flag[default_flags_string.length];
|
Flag[] default_flags = new Flag[default_flags_string.length];
|
||||||
|
@ -52,13 +52,16 @@ public class Claim extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(!schematic.equals("")) {
|
if(!schematic.equals("")) {
|
||||||
|
PlotWorld world = PlotMain.getWorldSettings(plot.getWorld());
|
||||||
|
if(world.SCHEMATIC_CLAIM_SPECIFY) {
|
||||||
|
if(!world.SCHEMATICS.contains(schematic.toLowerCase())) {
|
||||||
|
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if(!plr.hasPermission("plots.claim." + schematic) && !plr.hasPermission("plots.admin")) {
|
if(!plr.hasPermission("plots.claim." + schematic) && !plr.hasPermission("plots.admin")) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
|
PlayerFunctions.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(new SchematicHandler().getSchematic(schematic) == null) {
|
|
||||||
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent");
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean result = claimPlot(plr, plot, false, schematic);
|
boolean result = claimPlot(plr, plot, false, schematic);
|
||||||
|
Loading…
Reference in New Issue
Block a user