mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-26 04:25:15 +01:00
Allow restricted area management from ingame
This commit is contained in:
parent
14423470ac
commit
29a9b9dee9
47
com/gamingmesh/jobs/api/JobsAreaSelectionEvent.java
Normal file
47
com/gamingmesh/jobs/api/JobsAreaSelectionEvent.java
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package com.gamingmesh.jobs.api;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import com.gamingmesh.jobs.container.CuboidArea;
|
||||||
|
|
||||||
|
public final class JobsAreaSelectionEvent extends Event implements Cancellable {
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
private boolean cancelled;
|
||||||
|
private CuboidArea area;
|
||||||
|
private Player player;
|
||||||
|
|
||||||
|
public JobsAreaSelectionEvent(Player player, CuboidArea area) {
|
||||||
|
this.player = player;
|
||||||
|
this.area = area;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlayer() {
|
||||||
|
return this.player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CuboidArea getArea() {
|
||||||
|
return area;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
cancelled = cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
}
|
132
com/gamingmesh/jobs/commands/list/area.java
Normal file
132
com/gamingmesh/jobs/commands/list/area.java
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
package com.gamingmesh.jobs.commands.list;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import com.gamingmesh.jobs.Jobs;
|
||||||
|
import com.gamingmesh.jobs.commands.Cmd;
|
||||||
|
import com.gamingmesh.jobs.commands.JobCommand;
|
||||||
|
import com.gamingmesh.jobs.config.RestrictedAreaManager;
|
||||||
|
import com.gamingmesh.jobs.container.CuboidArea;
|
||||||
|
import com.gamingmesh.jobs.container.RestrictedArea;
|
||||||
|
|
||||||
|
public class area implements Cmd {
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
|
@JobCommand(300)
|
||||||
|
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||||
|
if (!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Player player = (Player) sender;
|
||||||
|
|
||||||
|
if (args.length == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
RestrictedAreaManager ra = Jobs.getRestrictedAreaManager();
|
||||||
|
|
||||||
|
if (args.length == 3 && args[0].equalsIgnoreCase("add") && player.hasPermission("jobs.area.add")) {
|
||||||
|
String name = args[1];
|
||||||
|
double bonus = 0D;
|
||||||
|
try {
|
||||||
|
bonus = Double.parseDouble(args[2]);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (ra.isExist(name)) {
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.exist"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Jobs.getSelectionManager().hasPlacedBoth(player)) {
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.select", "%tool%", Material.getMaterial(Jobs.getGCManager().getSelectionTooldID).name().toLowerCase()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
ra.addNew(new RestrictedArea(name, Jobs.getSelectionManager().getSelectionCuboid(player), bonus), true);
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.addedNew", "%bonus%", bonus));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.length == 2 && args[0].equalsIgnoreCase("remove") && player.hasPermission("jobs.area.remove")) {
|
||||||
|
String name = args[1];
|
||||||
|
|
||||||
|
if (!ra.isExist(name)) {
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.dontExist"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ra.remove(name, true);
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.removed", "%name%", name));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.length == 1 && args[0].equalsIgnoreCase("info")) {
|
||||||
|
|
||||||
|
List<RestrictedArea> areas = Jobs.getRestrictedAreaManager().getRestrictedAreasByLoc(player.getLocation());
|
||||||
|
|
||||||
|
String msg = "";
|
||||||
|
|
||||||
|
for (RestrictedArea area : areas) {
|
||||||
|
if (!msg.isEmpty())
|
||||||
|
msg += ", ";
|
||||||
|
msg += area.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (msg.isEmpty()) {
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.noAreasByLoc"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.areaList", "%list%", msg));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.length == 1 && args[0].equalsIgnoreCase("list")) {
|
||||||
|
|
||||||
|
HashMap<String, RestrictedArea> areas = Jobs.getRestrictedAreaManager().getRestrictedAres();
|
||||||
|
if (areas.isEmpty()) {
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.noAreas"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
||||||
|
int i = 0;
|
||||||
|
for (Entry<String, RestrictedArea> area : areas.entrySet()) {
|
||||||
|
i++;
|
||||||
|
CuboidArea cuboid = area.getValue().getCuboidArea();
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.list", "%number%", i,
|
||||||
|
"%areaname%", area.getKey(),
|
||||||
|
"%worldname%", cuboid.getWorld().getName(),
|
||||||
|
"%x1%", cuboid.getLowLoc().getBlockX(),
|
||||||
|
"%y1%", cuboid.getLowLoc().getBlockY(),
|
||||||
|
"%z1%", cuboid.getLowLoc().getBlockZ(),
|
||||||
|
"%x2%", cuboid.getHighLoc().getBlockX(),
|
||||||
|
"%y2%", cuboid.getHighLoc().getBlockY(),
|
||||||
|
"%z2%", cuboid.getHighLoc().getBlockZ(),
|
||||||
|
"%bonus%", area.getValue().getMultiplier()));
|
||||||
|
}
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.length > 1) {
|
||||||
|
if (args[0].equalsIgnoreCase("add")) {
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.help.addUsage"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (args[0].equalsIgnoreCase("remove")) {
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.help.removeUsage"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -344,6 +344,7 @@ public class GeneralConfigManager {
|
|||||||
*
|
*
|
||||||
* loads from Jobs/generalConfig.yml
|
* loads from Jobs/generalConfig.yml
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private synchronized void loadGeneralSettings() {
|
private synchronized void loadGeneralSettings() {
|
||||||
File f = new File(plugin.getDataFolder(), "generalConfig.yml");
|
File f = new File(plugin.getDataFolder(), "generalConfig.yml");
|
||||||
YamlConfiguration conf = YamlConfiguration.loadConfiguration(f);
|
YamlConfiguration conf = YamlConfiguration.loadConfiguration(f);
|
||||||
@ -415,6 +416,8 @@ public class GeneralConfigManager {
|
|||||||
saveOnDisconnect = c.get("save-on-disconnect", false);
|
saveOnDisconnect = c.get("save-on-disconnect", false);
|
||||||
|
|
||||||
getSelectionTooldID = c.get("selectionTool", 294);
|
getSelectionTooldID = c.get("selectionTool", 294);
|
||||||
|
if (Material.getMaterial(Jobs.getGCManager().getSelectionTooldID) == null)
|
||||||
|
getSelectionTooldID = 294;
|
||||||
|
|
||||||
c.getW().addComment("MultiServerCompatability", "Enable if you are using one data base for multiple servers across bungee network",
|
c.getW().addComment("MultiServerCompatability", "Enable if you are using one data base for multiple servers across bungee network",
|
||||||
"This will force to load players data every time he is logging in to have most up to date data instead of having preloaded data",
|
"This will force to load players data every time he is logging in to have most up to date data instead of having preloaded data",
|
||||||
|
@ -347,6 +347,23 @@ public class LanguageManager {
|
|||||||
c.get("command.gtop.output.prev", "&e<<<<< Prev page &2|");
|
c.get("command.gtop.output.prev", "&e<<<<< Prev page &2|");
|
||||||
c.get("command.gtop.output.next", "&2|&e Next Page >>>>");
|
c.get("command.gtop.output.next", "&2|&e Next Page >>>>");
|
||||||
c.get("command.gtop.output.show", "&2Show from &e[from] &2until &e[until] &2global top list");
|
c.get("command.gtop.output.show", "&2Show from &e[from] &2until &e[until] &2global top list");
|
||||||
|
|
||||||
|
|
||||||
|
c.get("command.area.help.info", "Modify restricted areas.");
|
||||||
|
c.get("command.area.help.args", "add/remove/info/list");
|
||||||
|
c.get("command.area.help.addUsage", "&eUsage: &6/Jobs area add [areaName] [bonus]");
|
||||||
|
c.get("command.area.help.removeUsage", "&eUsage: &6/Jobs area remove [areaName]");
|
||||||
|
c.get("command.area.output.addedNew", "&eAdded new restricted area with &6%bonus% &ebonus");
|
||||||
|
c.get("command.area.output.removed", "&eRemoved restricted area &6%name%");
|
||||||
|
c.get("command.area.output.list", "&e%number%&a. &e%areaname% &e%worldname% (&a%x1%:%y1%:%z1%/&e%x2%:%y2%:%z2%) &6%bonus%");
|
||||||
|
c.get("command.area.output.noAreas", "&eThere is no saved restricted areas");
|
||||||
|
c.get("command.area.output.noAreasByLoc", "&eThere is no restricted areas in this location");
|
||||||
|
c.get("command.area.output.areaList", "&eRestricted areas by your location: &6%list%");
|
||||||
|
c.get("command.area.output.selected1", "&eSelected first point: &6%x%:%y%:%z%");
|
||||||
|
c.get("command.area.output.selected2", "&eSelected second point: &6%x%:%y%:%z%");
|
||||||
|
c.get("command.area.output.select", "&eSelect 2 points with selection tool (%tool%)");
|
||||||
|
c.get("command.area.output.exist", "&eRestriction area by this name already exist");
|
||||||
|
c.get("command.area.output.dontExist", "&eRestriction area by this name don't exist");
|
||||||
|
|
||||||
c.get("command.log.help.info", "Shows statistics.");
|
c.get("command.log.help.info", "Shows statistics.");
|
||||||
c.get("command.log.help.args", "[playername]");
|
c.get("command.log.help.args", "[playername]");
|
||||||
|
@ -46,6 +46,21 @@ public class RestrictedAreaManager {
|
|||||||
if (save)
|
if (save)
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void remove(String name, boolean save) {
|
||||||
|
for (Entry<String, RestrictedArea> area : restrictedAreas.entrySet()) {
|
||||||
|
if (area.getKey().equalsIgnoreCase(name)){
|
||||||
|
restrictedAreas.remove(area.getKey());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (save)
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<String, RestrictedArea> getRestrictedAres(){
|
||||||
|
return restrictedAreas;
|
||||||
|
}
|
||||||
|
|
||||||
private void save() {
|
private void save() {
|
||||||
File f = new File(plugin.getDataFolder(), "restrictedAreas.yml");
|
File f = new File(plugin.getDataFolder(), "restrictedAreas.yml");
|
||||||
|
72
com/gamingmesh/jobs/container/CuboidArea.java
Normal file
72
com/gamingmesh/jobs/container/CuboidArea.java
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
package com.gamingmesh.jobs.container;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
public class CuboidArea {
|
||||||
|
protected Location highPoints;
|
||||||
|
protected Location lowPoints;
|
||||||
|
protected String worldName;
|
||||||
|
|
||||||
|
protected CuboidArea() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CuboidArea(Location startLoc, Location endLoc) {
|
||||||
|
int highx, highy, highz, lowx, lowy, lowz;
|
||||||
|
if (startLoc.getBlockX() > endLoc.getBlockX()) {
|
||||||
|
highx = startLoc.getBlockX();
|
||||||
|
lowx = endLoc.getBlockX();
|
||||||
|
} else {
|
||||||
|
highx = endLoc.getBlockX();
|
||||||
|
lowx = startLoc.getBlockX();
|
||||||
|
}
|
||||||
|
if (startLoc.getBlockY() > endLoc.getBlockY()) {
|
||||||
|
highy = startLoc.getBlockY();
|
||||||
|
lowy = endLoc.getBlockY();
|
||||||
|
} else {
|
||||||
|
highy = endLoc.getBlockY();
|
||||||
|
lowy = startLoc.getBlockY();
|
||||||
|
}
|
||||||
|
if (startLoc.getBlockZ() > endLoc.getBlockZ()) {
|
||||||
|
highz = startLoc.getBlockZ();
|
||||||
|
lowz = endLoc.getBlockZ();
|
||||||
|
} else {
|
||||||
|
highz = endLoc.getBlockZ();
|
||||||
|
lowz = startLoc.getBlockZ();
|
||||||
|
}
|
||||||
|
highPoints = new Location(startLoc.getWorld(), highx, highy, highz);
|
||||||
|
lowPoints = new Location(startLoc.getWorld(), lowx, lowy, lowz);
|
||||||
|
worldName = startLoc.getWorld().getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getSize() {
|
||||||
|
int xsize = (highPoints.getBlockX() - lowPoints.getBlockX()) + 1;
|
||||||
|
int zsize = (highPoints.getBlockZ() - lowPoints.getBlockZ()) + 1;
|
||||||
|
int ysize = (highPoints.getBlockY() - lowPoints.getBlockY()) + 1;
|
||||||
|
return xsize * ysize * zsize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getXSize() {
|
||||||
|
return (highPoints.getBlockX() - lowPoints.getBlockX()) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getYSize() {
|
||||||
|
return (highPoints.getBlockY() - lowPoints.getBlockY()) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getZSize() {
|
||||||
|
return (highPoints.getBlockZ() - lowPoints.getBlockZ()) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getHighLoc() {
|
||||||
|
return highPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getLowLoc() {
|
||||||
|
return lowPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public World getWorld() {
|
||||||
|
return highPoints.getWorld();
|
||||||
|
}
|
||||||
|
}
|
@ -49,6 +49,10 @@ public class Language {
|
|||||||
* @param key - the key of the message
|
* @param key - the key of the message
|
||||||
* @return the message
|
* @return the message
|
||||||
*/
|
*/
|
||||||
|
public String getMessage(String key) {
|
||||||
|
return getMessage(key, "");
|
||||||
|
}
|
||||||
|
|
||||||
public String getMessage(String key, Object... variables) {
|
public String getMessage(String key, Object... variables) {
|
||||||
String missing = "Missing locale for " + key + " ";
|
String missing = "Missing locale for " + key + " ";
|
||||||
String msg = "";
|
String msg = "";
|
||||||
|
@ -93,23 +93,23 @@ public class JobsListener implements Listener {
|
|||||||
int heldItemId = iih.getTypeId();
|
int heldItemId = iih.getTypeId();
|
||||||
if (heldItemId != Jobs.getGCManager().getSelectionTooldID())
|
if (heldItemId != Jobs.getGCManager().getSelectionTooldID())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!player.hasPermission("jobs.selectarea"))
|
if (!player.hasPermission("jobs.area.select"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (player.getGameMode() == GameMode.CREATIVE)
|
if (player.getGameMode() == GameMode.CREATIVE)
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
Block block = event.getClickedBlock();
|
Block block = event.getClickedBlock();
|
||||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||||
Location loc = block.getLocation();
|
Location loc = block.getLocation();
|
||||||
Jobs.getSelectionManager().placeLoc1(player, loc);
|
Jobs.getSelectionManager().placeLoc1(player, loc);
|
||||||
player.sendMessage("Selected: " + loc.getBlockX() + ":" + loc.getBlockY() + ":" + loc.getBlockZ());
|
player.sendMessage(Jobs.getLanguage().getMessage("command.area.output.selected1", "%x%", loc.getBlockX(), "%y%", loc.getBlockY(), "%z%", loc.getBlockZ()));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
} else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
Location loc = block.getLocation();
|
Location loc = block.getLocation();
|
||||||
Jobs.getSelectionManager().placeLoc2(player, loc);
|
Jobs.getSelectionManager().placeLoc2(player, loc);
|
||||||
player.sendMessage("Selected: " + loc.getBlockX() + ":" + loc.getBlockY() + ":" + loc.getBlockZ());
|
player.sendMessage(Jobs.getLanguage().getMessage("command.area.output.selected2", "%x%", loc.getBlockX(), "%y%", loc.getBlockY(), "%z%", loc.getBlockZ()));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
com/gamingmesh/jobs/selection/.gitignore
vendored
Normal file
6
com/gamingmesh/jobs/selection/.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/AutoSelection.class
|
||||||
|
/SchematicsManager.class
|
||||||
|
/SelectionManager$Direction.class
|
||||||
|
/SelectionManager.class
|
||||||
|
/WorldEditSelectionManager.class
|
||||||
|
/WorldGuardUtil.class
|
109
com/gamingmesh/jobs/selection/SelectionManager.java
Normal file
109
com/gamingmesh/jobs/selection/SelectionManager.java
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
package com.gamingmesh.jobs.selection;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import com.gamingmesh.jobs.container.CuboidArea;
|
||||||
|
|
||||||
|
public class SelectionManager {
|
||||||
|
protected Map<String, Location> playerLoc1;
|
||||||
|
protected Map<String, Location> playerLoc2;
|
||||||
|
|
||||||
|
public static final int MIN_HEIGHT = 0;
|
||||||
|
|
||||||
|
public SelectionManager() {
|
||||||
|
playerLoc1 = Collections.synchronizedMap(new HashMap<String, Location>());
|
||||||
|
playerLoc2 = Collections.synchronizedMap(new HashMap<String, Location>());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateLocations(Player player, Location loc1, Location loc2) {
|
||||||
|
if (loc1 != null && loc2 != null) {
|
||||||
|
playerLoc1.put(player.getName(), loc1);
|
||||||
|
playerLoc2.put(player.getName(), loc2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void placeLoc1(Player player, Location loc) {
|
||||||
|
if (loc != null) {
|
||||||
|
playerLoc1.put(player.getName(), loc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void placeLoc2(Player player, Location loc) {
|
||||||
|
if (loc != null) {
|
||||||
|
playerLoc2.put(player.getName(), loc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getPlayerLoc1(Player player) {
|
||||||
|
return getPlayerLoc1(player.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getPlayerLoc1(String player) {
|
||||||
|
return playerLoc1.get(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getPlayerLoc2(Player player) {
|
||||||
|
return getPlayerLoc2(player.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getPlayerLoc2(String player) {
|
||||||
|
return playerLoc2.get(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CuboidArea getSelectionCuboid(Player player) {
|
||||||
|
return getSelectionCuboid(player.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public CuboidArea getSelectionCuboid(String player) {
|
||||||
|
return new CuboidArea(getPlayerLoc1(player), getPlayerLoc2(player));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasPlacedBoth(Player player) {
|
||||||
|
return hasPlacedBoth(player.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasPlacedBoth(String player) {
|
||||||
|
return playerLoc1.containsKey(player) && playerLoc2.containsKey(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearSelection(Player player) {
|
||||||
|
playerLoc1.remove(player.getName());
|
||||||
|
playerLoc2.remove(player.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectChunk(Player player) {
|
||||||
|
Chunk chunk = player.getWorld().getChunkAt(player.getLocation());
|
||||||
|
int xcoord = chunk.getX() * 16;
|
||||||
|
int zcoord = chunk.getZ() * 16;
|
||||||
|
int ycoord = MIN_HEIGHT;
|
||||||
|
int xmax = xcoord + 15;
|
||||||
|
int zmax = zcoord + 15;
|
||||||
|
int ymax = player.getLocation().getWorld().getMaxHeight() - 1;
|
||||||
|
playerLoc1.put(player.getName(), new Location(player.getWorld(), xcoord, ycoord, zcoord));
|
||||||
|
playerLoc2.put(player.getName(), new Location(player.getWorld(), xmax, ymax, zmax));
|
||||||
|
player.sendMessage("msg");
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean worldEdit(Player player) {
|
||||||
|
player.sendMessage("msg");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean worldEditUpdate(Player player) {
|
||||||
|
player.sendMessage("msg");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectBySize(Player player, int xsize, int ysize, int zsize) {
|
||||||
|
Location myloc = player.getLocation();
|
||||||
|
Location loc1 = new Location(myloc.getWorld(), myloc.getBlockX() + xsize, myloc.getBlockY() + ysize, myloc.getBlockZ() + zsize);
|
||||||
|
Location loc2 = new Location(myloc.getWorld(), myloc.getBlockX() - xsize, myloc.getBlockY() - ysize, myloc.getBlockZ() - zsize);
|
||||||
|
placeLoc1(player, loc1);
|
||||||
|
placeLoc2(player, loc2);
|
||||||
|
player.sendMessage("msg");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user