Misc. changes and removal of title manager

This commit is contained in:
MattBDev
2019-05-17 18:49:09 -04:00
parent 4e3a927323
commit 5dd2610b5e
26 changed files with 112 additions and 126 deletions

View File

@ -7,7 +7,6 @@ import com.github.intellectualsites.plotsquared.bukkit.listeners.PlayerEvents;
import com.github.intellectualsites.plotsquared.bukkit.listeners.PlotPlusListener;
import com.github.intellectualsites.plotsquared.bukkit.listeners.SingleWorldListener;
import com.github.intellectualsites.plotsquared.bukkit.listeners.WorldEvents;
import com.github.intellectualsites.plotsquared.bukkit.titles.DefaultTitle;
import com.github.intellectualsites.plotsquared.bukkit.util.*;
import com.github.intellectualsites.plotsquared.bukkit.util.block.BukkitLocalQueue;
import com.github.intellectualsites.plotsquared.bukkit.uuid.DefaultUUIDWrapper;
@ -766,10 +765,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
return new BukkitSchematicHandler();
}
@Override public AbstractTitle initTitleManager() {
return new DefaultTitle();
}
@Override @Nullable public PlotPlayer wrapPlayer(final Object player) {
if (player instanceof Player) {
return BukkitUtil.getPlayer((Player) player);

View File

@ -43,10 +43,6 @@ public final class Reflection {
*/
public synchronized static String getVersion() {
if (_versionString == null) {
if (Bukkit.getServer() == null) {
// The server hasn't started, static initializer call?
return null;
}
String name = Bukkit.getServer().getClass().getPackage().getName();
_versionString = name.substring(name.lastIndexOf('.') + 1) + ".";
}
@ -180,15 +176,11 @@ public final class Reflection {
* @return A method object with the specified name declared by the specified class.
*/
public synchronized static Method getMethod(Class<?> clazz, String name, Class<?>... args) {
if (!_loadedMethods.containsKey(clazz)) {
_loadedMethods.put(clazz, new HashMap<>());
}
_loadedMethods.computeIfAbsent(clazz, k -> new HashMap<>());
Map<String, Map<ArrayWrapper<Class<?>>, Method>> loadedMethodNames =
_loadedMethods.get(clazz);
if (!loadedMethodNames.containsKey(name)) {
loadedMethodNames.put(name, new HashMap<>());
}
loadedMethodNames.computeIfAbsent(name, k -> new HashMap<>());
Map<ArrayWrapper<Class<?>>, Method> loadedSignatures = loadedMethodNames.get(name);
ArrayWrapper<Class<?>> wrappedArg = new ArrayWrapper<>(args);

View File

@ -999,7 +999,7 @@ import java.util.regex.Pattern;
} else if (
(location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT)
&& !Permissions
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) {
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
event.setCancelled(true);
MainUtil.sendMessage(plotPlayer, Captions.HEIGHT_LIMIT.s()
.replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
@ -2984,7 +2984,7 @@ import java.util.regex.Pattern;
Plot plot = area.getPlot(location);
if (plot != null) {
if ((location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT)
&& !Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) {
&& !Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
event.setCancelled(true);
MainUtil.sendMessage(pp, Captions.HEIGHT_LIMIT.s()
.replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));

View File

@ -84,6 +84,11 @@ public class BukkitPlayer extends PlotPlayer {
return true;
}
@Override
public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) {
player.sendTitle(title, subtitle, fadeIn, stay, fadeOut);
}
private void callEvent(final Event event) {
RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners();
for (RegisteredListener listener : listeners) {
@ -219,8 +224,6 @@ public class BukkitPlayer extends PlotPlayer {
this.player.setPlayerWeather(WeatherType.DOWNFALL);
break;
case RESET:
this.player.resetPlayerWeather();
break;
default:
this.player.resetPlayerWeather();
break;
@ -254,8 +257,6 @@ public class BukkitPlayer extends PlotPlayer {
this.player.setGameMode(GameMode.SPECTATOR);
break;
case SURVIVAL:
this.player.setGameMode(GameMode.SURVIVAL);
break;
default:
this.player.setGameMode(GameMode.SURVIVAL);
break;

View File

@ -1,7 +1,12 @@
package com.github.intellectualsites.plotsquared.bukkit.object.entity;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import org.bukkit.*;
import org.bukkit.Art;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Rotation;
import org.bukkit.TreeSpecies;
import org.bukkit.World;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.*;
import org.bukkit.inventory.EntityEquipment;
@ -576,14 +581,6 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
restoreAgeable((Ageable) entity);
restoreLiving((LivingEntity) entity);
return entity;
case GUARDIAN:
case ELDER_GUARDIAN:
restoreLiving((LivingEntity) entity);
return entity;
case SKELETON:
case WITHER_SKELETON:
restoreLiving((LivingEntity) entity);
return entity;
case ARMOR_STAND:
// CHECK positions
ArmorStand stand = (ArmorStand) entity;
@ -679,6 +676,10 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
case BLAZE:
case SNOWMAN:
case SHULKER:
case GUARDIAN:
case ELDER_GUARDIAN:
case SKELETON:
case WITHER_SKELETON:
restoreLiving((LivingEntity) entity);
return entity;
case IRON_GOLEM:

View File

@ -1,15 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.titles;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle;
import org.bukkit.entity.Player;
public class DefaultTitle extends AbstractTitle {
@Override
public void sendTitle(PlotPlayer player, String head, String sub, int in, int delay, int out) {
final Player playerObj = ((BukkitPlayer) player).player;
playerObj.sendTitle(head, sub, in, delay, out);
}
}