Scoreboard changes, Fix region values, add 1.8 Border for map
This commit is contained in:
parent
2735c81205
commit
a0d97d5d99
@ -188,7 +188,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize default region factions and territory (spawn/fields/borderlands)
|
// Initialize default region factions and territory (spawn/fields/borderlands)
|
||||||
_clanRegions = new ClansRegions(this);
|
_clanRegions = new ClansRegions(plugin, this);
|
||||||
_clanRegions.initializeRegions();
|
_clanRegions.initializeRegions();
|
||||||
|
|
||||||
new ClansScoreboardManager(plugin, this, clientManager, donationManager);
|
new ClansScoreboardManager(plugin, this, clientManager, donationManager);
|
||||||
|
@ -6,33 +6,43 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import mineplex.core.MiniPlugin;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilWorld;
|
import mineplex.core.common.util.UtilWorld;
|
||||||
|
import mineplex.core.packethandler.PacketPlayOutWorldBorder;
|
||||||
import mineplex.game.clans.clans.ClanInfo;
|
import mineplex.game.clans.clans.ClanInfo;
|
||||||
import mineplex.game.clans.clans.ClansDataAccessLayer;
|
import mineplex.game.clans.clans.ClansDataAccessLayer;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.spawn.Spawn;
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
|
|
||||||
public class ClansRegions
|
public class ClansRegions extends MiniPlugin
|
||||||
{
|
{
|
||||||
public final static String DEFAULT_WORLD_NAME = "world";
|
public final static String DEFAULT_WORLD_NAME = "world";
|
||||||
public final static int SPAWN_RADIUS = 2; // Radius of spawn claim area (measured in chunks)
|
public final static int SPAWN_RADIUS = 2; // Radius of spawn claim area (measured in chunks)
|
||||||
public final static int SHOP_RADIUS = 1; // Radius of shop claim area (measured in chunks)
|
public final static int SHOP_RADIUS = 1; // Radius of shop claim area (measured in chunks)
|
||||||
public final static int FIELDS_RADIUS = 7; // Radius of fields claim area (measured in chunks)
|
public final static int FIELDS_RADIUS = 7; // Radius of fields claim area (measured in chunks)
|
||||||
public final static int BORDERLANDS_RADIUS = 75; // Radius of borderlands claim area (measured in chunks)
|
public final static int BORDERLANDS_RADIUS = 41; // Radius of borderlands claim area (measured in chunks)
|
||||||
|
public static final int BORDER_RADIUS = 512;
|
||||||
|
|
||||||
private ClansManager _manager;
|
private ClansManager _manager;
|
||||||
private World _world;
|
private World _world;
|
||||||
|
|
||||||
public ClansRegions(ClansManager manager, String worldName)
|
public ClansRegions(JavaPlugin plugin, ClansManager manager, String worldName)
|
||||||
{
|
{
|
||||||
|
super("Clans Regions - " + worldName, plugin);
|
||||||
_manager = manager;
|
_manager = manager;
|
||||||
_world = Bukkit.getWorld(worldName);
|
_world = Bukkit.getWorld(worldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClansRegions(ClansManager manager)
|
public ClansRegions(JavaPlugin plugin, ClansManager manager)
|
||||||
{
|
{
|
||||||
this(manager, DEFAULT_WORLD_NAME);
|
this(plugin, manager, DEFAULT_WORLD_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initializeRegions()
|
public void initializeRegions()
|
||||||
@ -48,7 +58,7 @@ public class ClansRegions
|
|||||||
|
|
||||||
// Initialize Fields and Borderlands factions and claims
|
// Initialize Fields and Borderlands factions and claims
|
||||||
claimArea("Fields", FIELDS_RADIUS, 0, false, worldCenter);
|
claimArea("Fields", FIELDS_RADIUS, 0, false, worldCenter);
|
||||||
claimArea("Borderlands", BORDERLANDS_RADIUS, 50, false, worldCenter);
|
claimArea("Borderlands", BORDERLANDS_RADIUS, 26, false, worldCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,9 +109,40 @@ public class ClansRegions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void log(String message)
|
private void sendBorder(Player player)
|
||||||
{
|
{
|
||||||
_manager.log(message);
|
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder();
|
||||||
|
packet.worldBorderType = 3;
|
||||||
|
|
||||||
|
packet.centerX = 0;
|
||||||
|
packet.centerZ = 0;
|
||||||
|
|
||||||
|
packet.newRadius = BORDER_RADIUS;
|
||||||
|
packet.oldRadius = BORDER_RADIUS;
|
||||||
|
|
||||||
|
packet.warningBlocks = -10;
|
||||||
|
packet.warningTime = -10;
|
||||||
|
|
||||||
|
if (UtilPlayer.is1_8(player))
|
||||||
|
{
|
||||||
|
UtilPlayer.sendPacket(player, packet);
|
||||||
|
System.out.println("Sent border to " + player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onJoin(PlayerJoinEvent event)
|
||||||
|
{
|
||||||
|
if (event.getPlayer().getWorld().equals(_world))
|
||||||
|
sendBorder(event.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler public void onTeleport(PlayerTeleportEvent event)
|
||||||
|
{
|
||||||
|
Location from = event.getFrom();
|
||||||
|
Location to = event.getTo();
|
||||||
|
if (!from.getWorld().equals(to.getWorld()) && to.getWorld().equals(_world))
|
||||||
|
sendBorder(event.getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,35 +15,32 @@ import mineplex.game.clans.clans.scoreboard.elements.ScoreboardElementClan;
|
|||||||
import mineplex.game.clans.clans.scoreboard.elements.ScoreboardElementPlayer;
|
import mineplex.game.clans.clans.scoreboard.elements.ScoreboardElementPlayer;
|
||||||
import mineplex.game.clans.clans.scoreboard.elements.ScoreboardElementWar;
|
import mineplex.game.clans.clans.scoreboard.elements.ScoreboardElementWar;
|
||||||
|
|
||||||
public class ClansScoreboardManager extends MiniPlugin
|
public class ClansScoreboardManager extends ScoreboardManager
|
||||||
{
|
{
|
||||||
private ScoreboardManager _scoreboardManager;
|
|
||||||
private ClansManager _clansManager;
|
private ClansManager _clansManager;
|
||||||
|
|
||||||
public ClansScoreboardManager(JavaPlugin plugin, ClansManager clansManager, CoreClientManager clientManager, DonationManager donationManager)
|
public ClansScoreboardManager(JavaPlugin plugin, ClansManager clansManager, CoreClientManager clientManager, DonationManager donationManager)
|
||||||
{
|
{
|
||||||
super("Clans Scoreboard", plugin);
|
super(plugin, clientManager, donationManager);
|
||||||
|
|
||||||
_scoreboardManager = new ScoreboardManager(plugin, clientManager, donationManager);
|
|
||||||
_clansManager = clansManager;
|
_clansManager = clansManager;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
_scoreboardManager.setTitle(" MINEPLEX CLANS ");
|
setTitle(" MINEPLEX CLANS ");
|
||||||
|
|
||||||
ScoreboardData data = _scoreboardManager.getData("default", true);
|
ScoreboardData data = getData("default", true);
|
||||||
|
|
||||||
|
data.writeEmpty();
|
||||||
data.writeElement(new ScoreboardElementClan(_clansManager));
|
data.writeElement(new ScoreboardElementClan(_clansManager));
|
||||||
data.writeEmpty();
|
|
||||||
|
|
||||||
|
data.writeEmpty();
|
||||||
data.writeElement(new ScoreboardElementWar(_clansManager, _clansManager.getWarManager()));
|
data.writeElement(new ScoreboardElementWar(_clansManager, _clansManager.getWarManager()));
|
||||||
data.writeEmpty();
|
|
||||||
|
|
||||||
data.writeElement(new ScoreboardElementPlayer(_clansManager));
|
|
||||||
data.writeEmpty();
|
data.writeEmpty();
|
||||||
|
data.writeElement(new ScoreboardElementPlayer(_clansManager));
|
||||||
|
|
||||||
data.writeElement(_clansManager.getWorldEvent());
|
data.writeElement(_clansManager.getWorldEvent());
|
||||||
}
|
}
|
||||||
@ -52,6 +49,6 @@ public class ClansScoreboardManager extends MiniPlugin
|
|||||||
public void drawUpdate(UpdateEvent event)
|
public void drawUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() == UpdateType.FAST)
|
if (event.getType() == UpdateType.FAST)
|
||||||
_scoreboardManager.draw();
|
draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,10 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
|
|||||||
ArrayList<String> output = new ArrayList<String>();
|
ArrayList<String> output = new ArrayList<String>();
|
||||||
|
|
||||||
if (_events.size() > 0)
|
if (_events.size() > 0)
|
||||||
|
{
|
||||||
|
output.add(" ");
|
||||||
output.add(C.cAqua + C.Bold + "Event");
|
output.add(C.cAqua + C.Bold + "Event");
|
||||||
|
}
|
||||||
|
|
||||||
Iterator<WorldEvent> iterator = _events.iterator();
|
Iterator<WorldEvent> iterator = _events.iterator();
|
||||||
while (iterator.hasNext())
|
while (iterator.hasNext())
|
||||||
|
Loading…
Reference in New Issue
Block a user