Nouvelle correction de bug du WorldBorder avec une pile d'entité + Affichage du MOTD que quand le serveur est fini de chargé

This commit is contained in:
2015-03-03 01:02:11 -05:00
parent 87453e9816
commit 8ee8b09384
5 changed files with 111 additions and 19 deletions

View File

@@ -36,6 +36,27 @@ public class PandacraftUtils extends JavaPlugin {
}
/**
* 'u' = stopped
* 'l' = loading
* 'r' = running
* 's' = stopping
*/
private static ServerState serverState = ServerState.STOPPED;
public static ServerState getServerState() { return serverState; }
public static void setServerState(ServerState s) { serverState = s; }
public enum ServerState{
STOPPED,
LOADING,
RUNNING,
STOPPING
}
//public DBConnection databaseConnection;
public AfkManager afkManager;
@@ -64,6 +85,8 @@ public class PandacraftUtils extends JavaPlugin {
@Override
public void onEnable(){
setServerState(ServerState.LOADING);
instance = this;
/*
@@ -107,9 +130,17 @@ public class PandacraftUtils extends JavaPlugin {
NetworkAPI.loadNewInstance();
getServer().getScheduler().runTaskLater(this, new Runnable() {
@Override public void run() { new PlayerDataCleaner(instance); }
@Override public void run() {
new PlayerDataCleaner(instance);
}
}, 1);
getServer().getScheduler().runTaskLater(this, new Runnable() {
@Override public void run() {
setServerState(ServerState.RUNNING);
}
}, 30);
}
@@ -117,6 +148,8 @@ public class PandacraftUtils extends JavaPlugin {
@Override
public void onDisable(){
setServerState(ServerState.STOPPING);
ConfigManager.getInstance().saveAll();
afkManager = null;

View File

@@ -16,6 +16,7 @@ import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.wrappers.WrappedGameProfile;
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils.ServerState;
import net.mc_pandacraft.java.plugin.pandacraftutils.config.ConfigManager;
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayer;
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager;
@@ -105,8 +106,10 @@ public class PacketOutServerInfoListener {
event.getPacket().getServerPings().read(0).setPlayersOnline(count_player);
event.getPacket().getServerPings().read(0).setMotD(ConfigManager.getInstance().defaultConfig.pingMOTD);
if (PandacraftUtils.getServerState().equals(ServerState.RUNNING))
event.getPacket().getServerPings().read(0).setMotD(ConfigManager.getInstance().defaultConfig.pingMOTD);
else
event.getPacket().getServerPings().read(0).setMotD(".");
}
}
);

View File

@@ -9,6 +9,7 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.config.ConfigManager;
import net.mc_pandacraft.java.plugin.pandacraftutils.config.elements.WorldBorderConfigEntry;
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayer;
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager;
import net.mc_pandacraft.java.util.bukkit.EntityStackUtil;
import net.mc_pandacraft.java.util.bukkit.protocol.ParticleEffect;
import org.bukkit.ChatColor;
@@ -47,7 +48,7 @@ public class WorldBorderManager extends BukkitRunnable implements Listener {
Location newLoc = checkPosition(op.getPlayer().getLocation(), config);
if (newLoc != null) { // le joueur dépasse la bordure
op.teleportWithVehicle(newLoc);
EntityStackUtil.teleportStack(op.getPlayer(), newLoc);
op.getPlayer().sendMessage(ChatColor.RED+"Vous avez été téléporté car vous avez passé la limite de la carte");
}

View File

@@ -14,8 +14,6 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.plugin_interface.Essentials
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable;
@@ -305,19 +303,6 @@ public class OnlinePlayer {
}
public boolean teleportWithVehicle(Location l) {
Entity toTeleport = player;
while (toTeleport.getVehicle() != null) {
toTeleport = toTeleport.getVehicle();
}
return toTeleport.teleport(l);
}