mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 05:36:45 +01:00
Removing entity listener (Can't figure out how to finish it)
This commit is contained in:
parent
7522184a34
commit
3035bd46d2
@ -871,8 +871,8 @@ import java.util.concurrent.TimeUnit;
|
|||||||
options.put("UUID.read-from-disk", Settings.UUID_FROM_DISK);
|
options.put("UUID.read-from-disk", Settings.UUID_FROM_DISK);
|
||||||
options.put("titles", Settings.TITLES);
|
options.put("titles", Settings.TITLES);
|
||||||
options.put("teleport.on_login", Settings.TELEPORT_ON_LOGIN);
|
options.put("teleport.on_login", Settings.TELEPORT_ON_LOGIN);
|
||||||
options.put("perm-based-mob-cap.enabled", Settings.MOB_CAP_ENABLED);
|
// options.put("perm-based-mob-cap.enabled", Settings.MOB_CAP_ENABLED);
|
||||||
options.put("perm-based-mob-cap.max", Settings.MOB_CAP);
|
// options.put("perm-based-mob-cap.max", Settings.MOB_CAP);
|
||||||
options.put("worldedit.require-selection-in-mask", Settings.REQUIRE_SELECTION);
|
options.put("worldedit.require-selection-in-mask", Settings.REQUIRE_SELECTION);
|
||||||
|
|
||||||
for (final Entry<String, Object> node : options.entrySet()) {
|
for (final Entry<String, Object> node : options.entrySet()) {
|
||||||
@ -893,8 +893,8 @@ import java.util.concurrent.TimeUnit;
|
|||||||
Settings.MAX_AUTO_SIZE = config.getInt("claim.max-auto-area");
|
Settings.MAX_AUTO_SIZE = config.getInt("claim.max-auto-area");
|
||||||
Settings.AUTO_CLEAR = config.getBoolean("clear.auto.enabled");
|
Settings.AUTO_CLEAR = config.getBoolean("clear.auto.enabled");
|
||||||
Settings.TITLES = config.getBoolean("titles");
|
Settings.TITLES = config.getBoolean("titles");
|
||||||
Settings.MOB_CAP_ENABLED = config.getBoolean("perm-based-mob-cap.enabled");
|
// Settings.MOB_CAP_ENABLED = config.getBoolean("perm-based-mob-cap.enabled");
|
||||||
Settings.MOB_CAP = config.getInt("perm-based-mob-cap.max");
|
// Settings.MOB_CAP = config.getInt("perm-based-mob-cap.max");
|
||||||
Settings.MAX_PLOTS = config.getInt("max_plots");
|
Settings.MAX_PLOTS = config.getInt("max_plots");
|
||||||
Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path");
|
Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path");
|
||||||
|
|
||||||
@ -1460,9 +1460,9 @@ import java.util.concurrent.TimeUnit;
|
|||||||
plotCommand.setAliases(Arrays.asList("p", "ps", "plotme", "plot"));
|
plotCommand.setAliases(Arrays.asList("p", "ps", "plotme", "plot"));
|
||||||
plotCommand.setTabCompleter(command);
|
plotCommand.setTabCompleter(command);
|
||||||
}
|
}
|
||||||
if (Settings.MOB_CAP_ENABLED) {
|
// if (Settings.MOB_CAP_ENABLED) {
|
||||||
getServer().getPluginManager().registerEvents(new EntityListener(), this);
|
// getServer().getPluginManager().registerEvents(new EntityListener(), this);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Main event handler
|
// Main event handler
|
||||||
getServer().getPluginManager().registerEvents(new PlayerEvents(), this);
|
getServer().getPluginManager().registerEvents(new PlayerEvents(), this);
|
||||||
|
@ -106,19 +106,6 @@ import java.util.UUID;
|
|||||||
PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED);
|
PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* if (!hasBeenOnServer(args[1])) {
|
|
||||||
* PlayerFunctions.sendMessage(plr, C.PLAYER_HAS_NOT_BEEN_ON);
|
|
||||||
* return true; } UUID uuid = null; if
|
|
||||||
* (Bukkit.getPlayer(args[1]) != null) { uuid =
|
|
||||||
* Bukkit.getPlayer(args[1]).getUniqueId(); } else { uuid =
|
|
||||||
* Bukkit.getOfflinePlayer(args[1]).getUniqueId(); } if (uuid ==
|
|
||||||
* null) { PlayerFunctions.sendMessage(plr,
|
|
||||||
* C.PLAYER_HAS_NOT_BEEN_ON); return true; } if
|
|
||||||
* (!plot.helpers.contains(uuid)) {
|
|
||||||
* PlayerFunctions.sendMessage(plr, C.WAS_NOT_ADDED); return
|
|
||||||
* true; }
|
|
||||||
*/
|
|
||||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||||
plot.removeHelper(uuid);
|
plot.removeHelper(uuid);
|
||||||
DBFunc.removeHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
|
DBFunc.removeHelper(plr.getWorld().getName(), plot, Bukkit.getOfflinePlayer(args[1]));
|
||||||
|
@ -56,11 +56,11 @@ public class Settings {
|
|||||||
/**
|
/**
|
||||||
* Mob Cap Enabled
|
* Mob Cap Enabled
|
||||||
*/
|
*/
|
||||||
public static boolean MOB_CAP_ENABLED = false;
|
// public static boolean MOB_CAP_ENABLED = false;
|
||||||
/**
|
/**
|
||||||
* The Mob Cap
|
* The Mob Cap
|
||||||
*/
|
*/
|
||||||
public static int MOB_CAP = 20;
|
// public static int MOB_CAP = 20;
|
||||||
/**
|
/**
|
||||||
* Display titles
|
* Display titles
|
||||||
*/
|
*/
|
||||||
|
@ -6,6 +6,7 @@ import com.intellectualcrafters.plot.config.Settings;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||||
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -110,7 +111,8 @@ import java.util.Set;
|
|||||||
mobs = 0;
|
mobs = 0;
|
||||||
}
|
}
|
||||||
if (!(PlotMain.hasPermissionRange(p, "plots.mobcap", Settings.MOB_CAP) > mobs)) {
|
if (!(PlotMain.hasPermissionRange(p, "plots.mobcap", Settings.MOB_CAP) > mobs)) {
|
||||||
PlayerFunctions.sendMessage(p, C.NO_PLOTS, "plots.mobcap." + (mobs + 1));
|
PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.mobcap." + (mobs + 1));
|
||||||
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,11 +151,14 @@ import java.util.Set;
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void addEntity(final Entity entity, final Plot plot) {
|
public static void addEntity(final Entity entity, final Plot plot) {
|
||||||
|
if (!entityMap.containsKey(plot.world)) {
|
||||||
|
entityMap.put(plot.world, new HashMap<Plot, HashSet<Integer>>());
|
||||||
|
}
|
||||||
if (!entityMap.containsKey(plot.world)) {
|
if (!entityMap.containsKey(plot.world)) {
|
||||||
entityMap.put(plot.world, new HashMap<Plot, HashSet<Integer>>());
|
entityMap.put(plot.world, new HashMap<Plot, HashSet<Integer>>());
|
||||||
}
|
}
|
||||||
final HashMap<Plot, HashSet<Integer>> section = entityMap.get(plot.world);
|
final HashMap<Plot, HashSet<Integer>> section = entityMap.get(plot.world);
|
||||||
if (section.containsKey(plot)) {
|
if (!section.containsKey(plot)) {
|
||||||
section.put(plot, new HashSet<Integer>());
|
section.put(plot, new HashSet<Integer>());
|
||||||
}
|
}
|
||||||
section.get(plot).add(entity.getEntityId());
|
section.get(plot).add(entity.getEntityId());
|
||||||
@ -164,6 +169,10 @@ import java.util.Set;
|
|||||||
final Entity entity = e.getEntity();
|
final Entity entity = e.getEntity();
|
||||||
final Location l = entity.getLocation();
|
final Location l = entity.getLocation();
|
||||||
final String w = l.getWorld().getName();
|
final String w = l.getWorld().getName();
|
||||||
|
remove(w, entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void remove(String w, Entity entity) {
|
||||||
if (entityMap.containsKey(w)) {
|
if (entityMap.containsKey(w)) {
|
||||||
final int id = entity.getEntityId();
|
final int id = entity.getEntityId();
|
||||||
final Plot plot = PlotHelper.getCurrentPlot(entity.getLocation());
|
final Plot plot = PlotHelper.getCurrentPlot(entity.getLocation());
|
||||||
|
Loading…
Reference in New Issue
Block a user