mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
Add bStats support, seeing as mcstats has been down for ages
This commit is contained in:
parent
3c48488c61
commit
23b9eca4ab
@ -2,6 +2,7 @@ repositories {
|
|||||||
maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" }
|
maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" }
|
||||||
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
|
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||||
maven { url "http://nexus.hc.to/content/repositories/pub_releases" }
|
maven { url "http://nexus.hc.to/content/repositories/pub_releases" }
|
||||||
|
maven { url = "https://repo.codemc.org/repository/maven-public" }
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10,6 +11,7 @@ dependencies {
|
|||||||
testCompile project(':Core')
|
testCompile project(':Core')
|
||||||
compile 'org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT'
|
compile 'org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT'
|
||||||
compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0-SNAPSHOT')
|
compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0-SNAPSHOT')
|
||||||
|
compile(group: 'org.bstats', name: 'bstats-bukkit', version: '1.4')
|
||||||
compile("net.milkbowl.vault:VaultAPI:1.7") {
|
compile("net.milkbowl.vault:VaultAPI:1.7") {
|
||||||
exclude module: 'bukkit'
|
exclude module: 'bukkit'
|
||||||
}
|
}
|
||||||
@ -34,8 +36,9 @@ jar.enabled = false
|
|||||||
shadowJar {
|
shadowJar {
|
||||||
dependencies {
|
dependencies {
|
||||||
include(dependency(':Core'))
|
include(dependency(':Core'))
|
||||||
|
include(dependency('org.bstats:bstats-bukkit:1.4'))
|
||||||
}
|
}
|
||||||
relocate('org.mcstats', 'com.plotsquared.stats')
|
// relocate('org.mcstats', 'com.plotsquared.stats')
|
||||||
archiveName = "${parent.name}-${project.name}-${parent.version}.jar"
|
archiveName = "${parent.name}-${project.name}-${parent.version}.jar"
|
||||||
destinationDir = file '../target'
|
destinationDir = file '../target'
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
@Getter private SingleWorldListener singleWorldListener;
|
@Getter private SingleWorldListener singleWorldListener;
|
||||||
private Method methodUnloadChunk0;
|
private Method methodUnloadChunk0;
|
||||||
private boolean methodUnloadSetup = false;
|
private boolean methodUnloadSetup = false;
|
||||||
|
private boolean metricsStarted;
|
||||||
|
|
||||||
@Override public int[] getServerVersion() {
|
@Override public int[] getServerVersion() {
|
||||||
if (this.version == null) {
|
if (this.version == null) {
|
||||||
@ -146,17 +147,14 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
|
|
||||||
new PlotSquared(this, "Bukkit");
|
new PlotSquared(this, "Bukkit");
|
||||||
if (Settings.Enabled_Components.METRICS) {
|
if (Settings.Enabled_Components.METRICS) {
|
||||||
new Metrics(this).start();
|
// new Metrics(this).start();
|
||||||
PlotSquared.log(C.PREFIX + "&6Metrics enabled.");
|
// PlotSquared.log(C.PREFIX + "&6Metrics enabled.");
|
||||||
|
this.startMetrics();
|
||||||
} else {
|
} else {
|
||||||
PlotSquared.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName()));
|
PlotSquared.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName()));
|
||||||
}
|
}
|
||||||
if (Settings.Enabled_Components.WORLDS) {
|
if (Settings.Enabled_Components.WORLDS) {
|
||||||
TaskManager.IMP.taskRepeat(new Runnable() {
|
TaskManager.IMP.taskRepeat(this::unload, 20);
|
||||||
@Override public void run() {
|
|
||||||
unload();
|
|
||||||
}
|
|
||||||
}, 20);
|
|
||||||
try {
|
try {
|
||||||
singleWorldListener = new SingleWorldListener(this);
|
singleWorldListener = new SingleWorldListener(this);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -165,7 +163,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unload() {
|
private void unload() {
|
||||||
if (!this.methodUnloadSetup) {
|
if (!this.methodUnloadSetup) {
|
||||||
this.methodUnloadSetup = true;
|
this.methodUnloadSetup = true;
|
||||||
try {
|
try {
|
||||||
@ -298,254 +296,250 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
|
|
||||||
@Override @SuppressWarnings("deprecation") public void runEntityTask() {
|
@Override @SuppressWarnings("deprecation") public void runEntityTask() {
|
||||||
PlotSquared.log(C.PREFIX + "KillAllEntities started.");
|
PlotSquared.log(C.PREFIX + "KillAllEntities started.");
|
||||||
TaskManager.runTaskRepeat(new Runnable() {
|
TaskManager.runTaskRepeat(() -> PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||||
@Override public void run() {
|
@Override public void run(PlotArea plotArea) {
|
||||||
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
final World world = Bukkit.getWorld(plotArea.worldname);
|
||||||
@Override public void run(PlotArea plotArea) {
|
try {
|
||||||
final World world = Bukkit.getWorld(plotArea.worldname);
|
if (world == null) {
|
||||||
try {
|
return;
|
||||||
if (world == null) {
|
}
|
||||||
return;
|
List<Entity> entities = world.getEntities();
|
||||||
}
|
Iterator<Entity> iterator = entities.iterator();
|
||||||
List<Entity> entities = world.getEntities();
|
while (iterator.hasNext()) {
|
||||||
Iterator<Entity> iterator = entities.iterator();
|
Entity entity = iterator.next();
|
||||||
while (iterator.hasNext()) {
|
switch (entity.getType()) {
|
||||||
Entity entity = iterator.next();
|
case EGG:
|
||||||
switch (entity.getType()) {
|
case COMPLEX_PART:
|
||||||
case EGG:
|
case FISHING_HOOK:
|
||||||
case COMPLEX_PART:
|
case ENDER_SIGNAL:
|
||||||
case FISHING_HOOK:
|
case LINGERING_POTION:
|
||||||
case ENDER_SIGNAL:
|
case AREA_EFFECT_CLOUD:
|
||||||
case LINGERING_POTION:
|
case EXPERIENCE_ORB:
|
||||||
case AREA_EFFECT_CLOUD:
|
case LEASH_HITCH:
|
||||||
case EXPERIENCE_ORB:
|
case FIREWORK:
|
||||||
case LEASH_HITCH:
|
case WEATHER:
|
||||||
case FIREWORK:
|
case LIGHTNING:
|
||||||
case WEATHER:
|
case WITHER_SKULL:
|
||||||
case LIGHTNING:
|
case UNKNOWN:
|
||||||
case WITHER_SKULL:
|
case PLAYER:
|
||||||
case UNKNOWN:
|
// non moving / unmovable
|
||||||
case PLAYER:
|
continue;
|
||||||
// non moving / unmovable
|
case THROWN_EXP_BOTTLE:
|
||||||
|
case SPLASH_POTION:
|
||||||
|
case SNOWBALL:
|
||||||
|
case SHULKER_BULLET:
|
||||||
|
case SPECTRAL_ARROW:
|
||||||
|
case TIPPED_ARROW:
|
||||||
|
case ENDER_PEARL:
|
||||||
|
case ARROW:
|
||||||
|
case LLAMA_SPIT:
|
||||||
|
// managed elsewhere | projectile
|
||||||
|
continue;
|
||||||
|
case ITEM_FRAME:
|
||||||
|
case PAINTING:
|
||||||
|
// Not vehicles
|
||||||
|
continue;
|
||||||
|
case ARMOR_STAND:
|
||||||
|
// Temporarily classify as vehicle
|
||||||
|
case MINECART:
|
||||||
|
case MINECART_CHEST:
|
||||||
|
case MINECART_COMMAND:
|
||||||
|
case MINECART_FURNACE:
|
||||||
|
case MINECART_HOPPER:
|
||||||
|
case MINECART_MOB_SPAWNER:
|
||||||
|
case ENDER_CRYSTAL:
|
||||||
|
case MINECART_TNT:
|
||||||
|
case BOAT:
|
||||||
|
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
|
||||||
|
com.github.intellectualsites.plotsquared.plot.object.Location
|
||||||
|
location =
|
||||||
|
BukkitUtil.getLocation(entity.getLocation());
|
||||||
|
Plot plot = location.getPlot();
|
||||||
|
if (plot == null) {
|
||||||
|
if (location.isPlotArea()) {
|
||||||
|
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
iterator.remove();
|
||||||
|
entity.remove();
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
case THROWN_EXP_BOTTLE:
|
}
|
||||||
case SPLASH_POTION:
|
List<MetadataValue> meta = entity.getMetadata("plot");
|
||||||
case SNOWBALL:
|
if (meta.isEmpty()) {
|
||||||
case SHULKER_BULLET:
|
|
||||||
case SPECTRAL_ARROW:
|
|
||||||
case TIPPED_ARROW:
|
|
||||||
case ENDER_PEARL:
|
|
||||||
case ARROW:
|
|
||||||
case LLAMA_SPIT:
|
|
||||||
// managed elsewhere | projectile
|
|
||||||
continue;
|
continue;
|
||||||
case ITEM_FRAME:
|
}
|
||||||
case PAINTING:
|
Plot origin = (Plot) meta.get(0).value();
|
||||||
// Not vehicles
|
if (!plot.equals(origin.getBasePlot(false))) {
|
||||||
continue;
|
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||||
case ARMOR_STAND:
|
continue;
|
||||||
// Temporarily classify as vehicle
|
}
|
||||||
case MINECART:
|
iterator.remove();
|
||||||
case MINECART_CHEST:
|
entity.remove();
|
||||||
case MINECART_COMMAND:
|
}
|
||||||
case MINECART_FURNACE:
|
continue;
|
||||||
case MINECART_HOPPER:
|
} else {
|
||||||
case MINECART_MOB_SPAWNER:
|
continue;
|
||||||
case ENDER_CRYSTAL:
|
}
|
||||||
case MINECART_TNT:
|
case SMALL_FIREBALL:
|
||||||
case BOAT:
|
case FIREBALL:
|
||||||
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
|
case DRAGON_FIREBALL:
|
||||||
com.github.intellectualsites.plotsquared.plot.object.Location
|
case DROPPED_ITEM:
|
||||||
location =
|
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
|
||||||
BukkitUtil.getLocation(entity.getLocation());
|
entity.remove();
|
||||||
Plot plot = location.getPlot();
|
}
|
||||||
if (plot == null) {
|
// dropped item
|
||||||
if (location.isPlotArea()) {
|
continue;
|
||||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
case PRIMED_TNT:
|
||||||
|
case FALLING_BLOCK:
|
||||||
|
// managed elsewhere
|
||||||
|
continue;
|
||||||
|
case LLAMA:
|
||||||
|
case DONKEY:
|
||||||
|
case MULE:
|
||||||
|
case ZOMBIE_HORSE:
|
||||||
|
case SKELETON_HORSE:
|
||||||
|
case HUSK:
|
||||||
|
case ELDER_GUARDIAN:
|
||||||
|
case WITHER_SKELETON:
|
||||||
|
case STRAY:
|
||||||
|
case ZOMBIE_VILLAGER:
|
||||||
|
case EVOKER:
|
||||||
|
case EVOKER_FANGS:
|
||||||
|
case VEX:
|
||||||
|
case VINDICATOR:
|
||||||
|
case POLAR_BEAR:
|
||||||
|
case BAT:
|
||||||
|
case BLAZE:
|
||||||
|
case CAVE_SPIDER:
|
||||||
|
case CHICKEN:
|
||||||
|
case COW:
|
||||||
|
case CREEPER:
|
||||||
|
case ENDERMAN:
|
||||||
|
case ENDERMITE:
|
||||||
|
case ENDER_DRAGON:
|
||||||
|
case GHAST:
|
||||||
|
case GIANT:
|
||||||
|
case GUARDIAN:
|
||||||
|
case HORSE:
|
||||||
|
case IRON_GOLEM:
|
||||||
|
case MAGMA_CUBE:
|
||||||
|
case MUSHROOM_COW:
|
||||||
|
case OCELOT:
|
||||||
|
case PIG:
|
||||||
|
case PIG_ZOMBIE:
|
||||||
|
case RABBIT:
|
||||||
|
case SHEEP:
|
||||||
|
case SILVERFISH:
|
||||||
|
case SKELETON:
|
||||||
|
case SLIME:
|
||||||
|
case SNOWMAN:
|
||||||
|
case SPIDER:
|
||||||
|
case SQUID:
|
||||||
|
case VILLAGER:
|
||||||
|
case WITCH:
|
||||||
|
case WITHER:
|
||||||
|
case WOLF:
|
||||||
|
case ZOMBIE:
|
||||||
|
default: {
|
||||||
|
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
|
||||||
|
Location location = entity.getLocation();
|
||||||
|
if (BukkitUtil.getLocation(location).isPlotRoad()) {
|
||||||
|
if (entity instanceof LivingEntity) {
|
||||||
|
LivingEntity livingEntity =
|
||||||
|
(LivingEntity) entity;
|
||||||
|
if (!livingEntity.isLeashed() || !entity
|
||||||
|
.hasMetadata("keep")) {
|
||||||
|
Entity passenger = entity.getPassenger();
|
||||||
|
if (!(passenger instanceof Player) && entity
|
||||||
|
.getMetadata("keep").isEmpty()) {
|
||||||
|
if (entity
|
||||||
|
.hasMetadata("ps-tmp-teleport")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
entity.remove();
|
entity.remove();
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
List<MetadataValue> meta = entity.getMetadata("plot");
|
} else {
|
||||||
if (meta.isEmpty()) {
|
Entity passenger = entity.getPassenger();
|
||||||
continue;
|
if (!(passenger instanceof Player) && entity
|
||||||
}
|
.getMetadata("keep").isEmpty()) {
|
||||||
Plot origin = (Plot) meta.get(0).value();
|
|
||||||
if (!plot.equals(origin.getBasePlot(false))) {
|
|
||||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
entity.remove();
|
entity.remove();
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
case SMALL_FIREBALL:
|
}
|
||||||
case FIREBALL:
|
}
|
||||||
case DRAGON_FIREBALL:
|
continue;
|
||||||
case DROPPED_ITEM:
|
}
|
||||||
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
|
case SHULKER: {
|
||||||
entity.remove();
|
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
|
||||||
}
|
LivingEntity livingEntity = (LivingEntity) entity;
|
||||||
// dropped item
|
List<MetadataValue> meta = entity.getMetadata("plot");
|
||||||
continue;
|
if (meta != null && !meta.isEmpty()) {
|
||||||
case PRIMED_TNT:
|
if (livingEntity.isLeashed())
|
||||||
case FALLING_BLOCK:
|
continue;
|
||||||
// managed elsewhere
|
|
||||||
continue;
|
List<MetadataValue> keep =
|
||||||
case LLAMA:
|
entity.getMetadata("keep");
|
||||||
case DONKEY:
|
if (keep != null && !keep.isEmpty())
|
||||||
case MULE:
|
continue;
|
||||||
case ZOMBIE_HORSE:
|
|
||||||
case SKELETON_HORSE:
|
PlotId originalPlotId =
|
||||||
case HUSK:
|
(PlotId) meta.get(0).value();
|
||||||
case ELDER_GUARDIAN:
|
if (originalPlotId != null) {
|
||||||
case WITHER_SKELETON:
|
com.github.intellectualsites.plotsquared.plot.object.Location
|
||||||
case STRAY:
|
pLoc = BukkitUtil
|
||||||
case ZOMBIE_VILLAGER:
|
.getLocation(entity.getLocation());
|
||||||
case EVOKER:
|
PlotArea area = pLoc.getPlotArea();
|
||||||
case EVOKER_FANGS:
|
if (area != null) {
|
||||||
case VEX:
|
PlotId currentPlotId =
|
||||||
case VINDICATOR:
|
PlotId.of(area.getPlotAbs(pLoc));
|
||||||
case POLAR_BEAR:
|
if (!originalPlotId.equals(currentPlotId)
|
||||||
case BAT:
|
&& (currentPlotId == null || !area
|
||||||
case BLAZE:
|
.getPlot(originalPlotId)
|
||||||
case CAVE_SPIDER:
|
.equals(area.getPlot(currentPlotId)))) {
|
||||||
case CHICKEN:
|
if (entity
|
||||||
case COW:
|
.hasMetadata("ps-tmp-teleport")) {
|
||||||
case CREEPER:
|
|
||||||
case ENDERMAN:
|
|
||||||
case ENDERMITE:
|
|
||||||
case ENDER_DRAGON:
|
|
||||||
case GHAST:
|
|
||||||
case GIANT:
|
|
||||||
case GUARDIAN:
|
|
||||||
case HORSE:
|
|
||||||
case IRON_GOLEM:
|
|
||||||
case MAGMA_CUBE:
|
|
||||||
case MUSHROOM_COW:
|
|
||||||
case OCELOT:
|
|
||||||
case PIG:
|
|
||||||
case PIG_ZOMBIE:
|
|
||||||
case RABBIT:
|
|
||||||
case SHEEP:
|
|
||||||
case SILVERFISH:
|
|
||||||
case SKELETON:
|
|
||||||
case SLIME:
|
|
||||||
case SNOWMAN:
|
|
||||||
case SPIDER:
|
|
||||||
case SQUID:
|
|
||||||
case VILLAGER:
|
|
||||||
case WITCH:
|
|
||||||
case WITHER:
|
|
||||||
case WOLF:
|
|
||||||
case ZOMBIE:
|
|
||||||
default: {
|
|
||||||
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
|
|
||||||
Location location = entity.getLocation();
|
|
||||||
if (BukkitUtil.getLocation(location).isPlotRoad()) {
|
|
||||||
if (entity instanceof LivingEntity) {
|
|
||||||
LivingEntity livingEntity =
|
|
||||||
(LivingEntity) entity;
|
|
||||||
if (!livingEntity.isLeashed() || !entity
|
|
||||||
.hasMetadata("keep")) {
|
|
||||||
Entity passenger = entity.getPassenger();
|
|
||||||
if (!(passenger instanceof Player) && entity
|
|
||||||
.getMetadata("keep").isEmpty()) {
|
|
||||||
if (entity
|
|
||||||
.hasMetadata("ps-tmp-teleport")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
iterator.remove();
|
|
||||||
entity.remove();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Entity passenger = entity.getPassenger();
|
|
||||||
if (!(passenger instanceof Player) && entity
|
|
||||||
.getMetadata("keep").isEmpty()) {
|
|
||||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
iterator.remove();
|
|
||||||
entity.remove();
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
iterator.remove();
|
||||||
|
entity.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
} else {
|
||||||
}
|
//This is to apply the metadata to already spawned shulkers (see EntitySpawnListener.java)
|
||||||
case SHULKER: {
|
com.github.intellectualsites.plotsquared.plot.object.Location
|
||||||
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
|
pLoc =
|
||||||
LivingEntity livingEntity = (LivingEntity) entity;
|
BukkitUtil.getLocation(entity.getLocation());
|
||||||
List<MetadataValue> meta = entity.getMetadata("plot");
|
PlotArea area = pLoc.getPlotArea();
|
||||||
if (meta != null && !meta.isEmpty()) {
|
if (area != null) {
|
||||||
if (livingEntity.isLeashed())
|
PlotId currentPlotId =
|
||||||
continue;
|
PlotId.of(area.getPlotAbs(pLoc));
|
||||||
|
if (currentPlotId != null) {
|
||||||
List<MetadataValue> keep =
|
entity.setMetadata("plot",
|
||||||
entity.getMetadata("keep");
|
new FixedMetadataValue(
|
||||||
if (keep != null && !keep.isEmpty())
|
(Plugin) PlotSquared.get().IMP,
|
||||||
continue;
|
currentPlotId));
|
||||||
|
|
||||||
PlotId originalPlotId =
|
|
||||||
(PlotId) meta.get(0).value();
|
|
||||||
if (originalPlotId != null) {
|
|
||||||
com.github.intellectualsites.plotsquared.plot.object.Location
|
|
||||||
pLoc = BukkitUtil
|
|
||||||
.getLocation(entity.getLocation());
|
|
||||||
PlotArea area = pLoc.getPlotArea();
|
|
||||||
if (area != null) {
|
|
||||||
PlotId currentPlotId =
|
|
||||||
PlotId.of(area.getPlotAbs(pLoc));
|
|
||||||
if (!originalPlotId.equals(currentPlotId)
|
|
||||||
&& (currentPlotId == null || !area
|
|
||||||
.getPlot(originalPlotId)
|
|
||||||
.equals(area.getPlot(currentPlotId)))) {
|
|
||||||
if (entity
|
|
||||||
.hasMetadata("ps-tmp-teleport")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
iterator.remove();
|
|
||||||
entity.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//This is to apply the metadata to already spawned shulkers (see EntitySpawnListener.java)
|
|
||||||
com.github.intellectualsites.plotsquared.plot.object.Location
|
|
||||||
pLoc =
|
|
||||||
BukkitUtil.getLocation(entity.getLocation());
|
|
||||||
PlotArea area = pLoc.getPlotArea();
|
|
||||||
if (area != null) {
|
|
||||||
PlotId currentPlotId =
|
|
||||||
PlotId.of(area.getPlotAbs(pLoc));
|
|
||||||
if (currentPlotId != null) {
|
|
||||||
entity.setMetadata("plot",
|
|
||||||
new FixedMetadataValue(
|
|
||||||
(Plugin) PlotSquared.get().IMP,
|
|
||||||
currentPlotId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 20);
|
}), 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Nullable
|
@Override @Nullable
|
||||||
@ -740,8 +734,13 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public void startMetrics() {
|
@Override public void startMetrics() {
|
||||||
new Metrics(this).start();
|
if (this.metricsStarted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// new Metrics(this).start(); mcstats
|
||||||
|
new org.bstats.bukkit.Metrics(this); // bstats
|
||||||
PlotSquared.log(C.PREFIX + "&6Metrics enabled.");
|
PlotSquared.log(C.PREFIX + "&6Metrics enabled.");
|
||||||
|
this.metricsStarted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void setGenerator(@NonNull final String worldName) {
|
@Override public void setGenerator(@NonNull final String worldName) {
|
||||||
@ -765,8 +764,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
if (!PlotSquared.get().hasPlotArea(worldName)) {
|
if (!PlotSquared.get().hasPlotArea(worldName)) {
|
||||||
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
|
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} catch (Exception e) {
|
||||||
PlotSquared.log("Failed to reload world: " + world + " | " + ignored.getMessage());
|
PlotSquared.log("Failed to reload world: " + world + " | " + e.getMessage());
|
||||||
Bukkit.getServer().unloadWorld(world, false);
|
Bukkit.getServer().unloadWorld(world, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ import java.util.stream.Collectors;
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
public class BukkitLegacyMappings extends LegacyMappings {
|
public final class BukkitLegacyMappings extends LegacyMappings {
|
||||||
|
|
||||||
private static final LegacyBlock[] BLOCKS =
|
private static final LegacyBlock[] BLOCKS =
|
||||||
new LegacyBlock[] {new LegacyBlock(0, "air"), new LegacyBlock(1, "stone"),
|
new LegacyBlock[] {new LegacyBlock(0, "air"), new LegacyBlock(1, "stone"),
|
||||||
@ -731,6 +731,9 @@ public class BukkitLegacyMappings extends LegacyMappings {
|
|||||||
* @return LegacyBlock if found, else null
|
* @return LegacyBlock if found, else null
|
||||||
*/
|
*/
|
||||||
public PlotBlock fromAny(@NonNull final String string) {
|
public PlotBlock fromAny(@NonNull final String string) {
|
||||||
|
if (string.isEmpty()) {
|
||||||
|
return StringPlotBlock.EVERYTHING;
|
||||||
|
}
|
||||||
String workingString = string;
|
String workingString = string;
|
||||||
String[] parts = null;
|
String[] parts = null;
|
||||||
if (string.contains(":")) {
|
if (string.contains(":")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user