Merge remote-tracking branch 'remotes/origin/develop' into virizion_speed_builder
This commit is contained in:
commit
528a7435e7
3
.gitignore
vendored
3
.gitignore
vendored
@ -52,3 +52,6 @@ zSotanna2
|
||||
/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/segments_1
|
||||
/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/write.lock
|
||||
/Pocket
|
||||
/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_
|
||||
/RemoteSystemsTempFiles
|
||||
/.recommenders/caches
|
||||
|
@ -0,0 +1,68 @@
|
||||
From 3b4526267e3bd53d9e70578ec1c7a8cd13038e73 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Fri, 27 Nov 2015 22:26:34 +1300
|
||||
Subject: [PATCH] Server freezing, fix fake yaw/pitch
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 7165579..4f366da 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Callable;
|
||||
+import com.google.common.primitives.Doubles;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -153,6 +154,12 @@ public abstract class Entity implements ICommandListener {
|
||||
public void setFakeHead(boolean fakeHead)
|
||||
{
|
||||
_fakeHead = fakeHead;
|
||||
+
|
||||
+ if (!isFakeHead())
|
||||
+ {
|
||||
+ this.fakeYaw = yaw;
|
||||
+ this.fakePitch = pitch;
|
||||
+ }
|
||||
}
|
||||
|
||||
public boolean isSilent()
|
||||
@@ -1024,9 +1031,18 @@ public abstract class Entity implements ICommandListener {
|
||||
this.lastX = this.locX = d0;
|
||||
this.lastY = this.locY = d1;
|
||||
this.lastZ = this.locZ = d2;
|
||||
- this.lastYaw = this.yaw = fakeYaw = f;
|
||||
- this.lastPitch = this.pitch = fakePitch = f1;
|
||||
+ this.lastYaw = this.yaw = f;
|
||||
+ this.lastPitch = this.pitch = f1;
|
||||
+
|
||||
+ if (!isFakeHead())
|
||||
+ {
|
||||
+ this.fakeYaw = yaw;
|
||||
+ this.fakePitch = pitch;
|
||||
+ }
|
||||
|
||||
+ if (!Doubles.isFinite(locX) || !Doubles.isFinite(locY) || !Doubles.isFinite(locZ))
|
||||
+ Thread.dumpStack();
|
||||
+
|
||||
if (this instanceof EntityLiving)
|
||||
((EntityLiving) this).aK = f;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 5edef3e..d3b1586 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -208,7 +208,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
|
||||
|
||||
public void a(PacketPlayInFlying packetplayinflying) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinflying, this, this.player.u());
|
||||
- if (this.b(packetplayinflying)) {
|
||||
+ if (this.b(packetplayinflying) || !Doubles.isFinite(player.locX) || !Doubles.isFinite(player.locY) || !Doubles.isFinite(player.locZ)) {
|
||||
this.disconnect("Invalid move packet received");
|
||||
} else {
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
--
|
||||
1.9.5.msysgit.0
|
||||
|
@ -0,0 +1,47 @@
|
||||
From 2522a926e6cc670f4f10657ea5494b5ffe81eb37 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Tue, 12 Jan 2016 19:56:07 +1300
|
||||
Subject: [PATCH] Sound and vehicle fixes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 4f366da..fc9cce0 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -1628,11 +1628,13 @@ public abstract class Entity implements ICommandListener {
|
||||
EntityDismountEvent exitEvent1 = null;
|
||||
if (this.vehicle != null) {
|
||||
if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle))
|
||||
+ {
|
||||
exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
|
||||
- pluginManager.callEvent(exitEvent);
|
||||
+ pluginManager.callEvent(exitEvent);
|
||||
|
||||
- if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
|
||||
- return;
|
||||
+ if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
|
||||
exitEvent1 = new EntityDismountEvent(this.vehicle.getBukkitEntity(), this.bukkitEntity);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
|
||||
index 0cc8f9b..dd07600 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
|
||||
@@ -14,9 +14,9 @@ public class CraftSound {
|
||||
set(AMBIENCE_RAIN, "ambient.weather.rain");
|
||||
set(AMBIENCE_THUNDER, "ambient.weather.thunder");
|
||||
// Damage
|
||||
- set(HURT_FLESH, "game.neutral.hurt");
|
||||
- set(FALL_BIG, "game.neutral.hurt.fall.big");
|
||||
- set(FALL_SMALL, "game.neutral.hurt.fall.small");
|
||||
+ set(HURT_FLESH, "game.player.hurt");
|
||||
+ set(FALL_BIG, "game.player.hurt.fall.big");
|
||||
+ set(FALL_SMALL, "game.player.hurt.fall.small");
|
||||
// Dig Sounds
|
||||
set(DIG_WOOL, "dig.cloth");
|
||||
set(DIG_GRASS, "dig.grass");
|
||||
--
|
||||
1.9.5.msysgit.0
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" hash="1486084220">
|
||||
<component name="DataSourceManagerImpl" format="xml" hash="3221233088">
|
||||
<data-source source="LOCAL" name="Mineplex" uuid="14dfc55d-5343-47c4-ab24-76a055b8059e">
|
||||
<driver-ref>mysql</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
|
Binary file not shown.
@ -57,6 +57,7 @@ public class MotdManager implements Listener, Runnable
|
||||
//String motdLine = "§f§l◄ §a§lCarl the Creeper§f§l ►";
|
||||
// String motdLine = " §2§l§n M O N S T E R M A Z E B E T A §f";
|
||||
String motdLine = " §f❄ §2§lMerry Christmas §f❄ §2§lElf Presents §f❄";
|
||||
// String motdLine = " §f❄ §2§lServer Maintenance §f❄ §2§lBe Back Soon §f❄";
|
||||
//String motdLine = " §d§lRank Sale §a§l40% Off");
|
||||
//String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►");
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class PlayerCache
|
||||
catch (Exception exception)
|
||||
{
|
||||
System.out.println("Error adding player info in PlayerCache : " + exception.getMessage());
|
||||
exception.printStackTrace();
|
||||
// exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,50 +9,59 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
public enum Rank
|
||||
{
|
||||
//Staff
|
||||
LT("Leader", ChatColor.GOLD),
|
||||
OWNER("Owner", ChatColor.GOLD),
|
||||
DEVELOPER("Dev", ChatColor.GOLD),
|
||||
ADMIN("Admin", ChatColor.GOLD),
|
||||
JNR_DEV("Jr.Dev", ChatColor.GOLD),
|
||||
SUPPORT("Support", ChatColor.BLUE),
|
||||
SNR_MODERATOR("Sr.Mod", ChatColor.GOLD),
|
||||
MODERATOR("Mod", ChatColor.GOLD),
|
||||
HELPER("Trainee", ChatColor.DARK_AQUA),
|
||||
MAPLEAD("MapLead", ChatColor.BLUE),
|
||||
MAPDEV("Builder", ChatColor.BLUE),
|
||||
MEDIA("Media", ChatColor.BLUE),
|
||||
LT("Leader", ChatColor.GOLD, "Leaders are in charge of special teams\nsuch as the whole staff team or the support!"),
|
||||
OWNER("Owner", ChatColor.GOLD, "Owners are the Founders of Mineplex\nand they all manage different parts of it!"),
|
||||
DEVELOPER("Dev", ChatColor.GOLD, "Developers make new games,\nand new features for you to enjoy"),
|
||||
ADMIN("Admin", ChatColor.GOLD, "Administrators have their own\nSenior Moderator team that they lead!"),
|
||||
JNR_DEV("Jr.Dev", ChatColor.GOLD, "Junior Developers make new games,\nand new features for you to enjoy"),
|
||||
SUPPORT("Support", ChatColor.BLUE, "Support Agents take care of all the tickets\nthat get sent to mineplex.com/support"),
|
||||
CMOD("C.Mod", ChatColor.GOLD, "Clan Moderators are Senior Moderators in\nthe Clans Management team.\nThey mainly moderate only the Clans servers.\nThey are around to help you with any problems on Clans servers."),
|
||||
SNR_MODERATOR("Sr.Mod", ChatColor.GOLD, "Senior Moderators are in a special\nSenior Moderator team where they have to fulfill team tasks.\nThey are similar to Moderators who you can always ask for help!\nIf you have any questions, just message them using /a"),
|
||||
MODERATOR("Mod", ChatColor.GOLD, "Moderators are here to moderate\nand help players with any concerns they have.\nIf you have any questions, just message them using /a"),
|
||||
HELPER("Trainee", ChatColor.DARK_AQUA, "Trainees are staff in training,\nand are here to help players and moderate!\nIf you have any questions, just message them using /a"),
|
||||
MAPLEAD("MapLead", ChatColor.BLUE, "Leader of the Official Build team"),
|
||||
MAPDEV("Builder", ChatColor.BLUE, "Official Mineplex Map Builders"),
|
||||
MEDIA("Media", ChatColor.BLUE, "Official Mineplex Artist and/or Designer"),
|
||||
|
||||
EVENT("Event", ChatColor.WHITE),
|
||||
EVENT("Event", ChatColor.WHITE, "???"),
|
||||
|
||||
//Media
|
||||
YOUTUBE("YouTube", ChatColor.RED),
|
||||
YOUTUBE_SMALL("YT", ChatColor.DARK_PURPLE),
|
||||
TWITCH("Twitch", ChatColor.DARK_PURPLE),
|
||||
YOUTUBE("YouTube", ChatColor.RED, "Official Mineplex Youtuber"),
|
||||
YOUTUBE_SMALL("YT", ChatColor.DARK_PURPLE, "Youtube Content Creators"),
|
||||
TWITCH("Twitch", ChatColor.DARK_PURPLE, "Official Twitch Live Streamer"),
|
||||
|
||||
//Player
|
||||
TITAN("Titan", ChatColor.RED, true),
|
||||
LEGEND("Legend", ChatColor.GREEN, true),
|
||||
HERO("Hero", ChatColor.LIGHT_PURPLE, true),
|
||||
ULTRA("Ultra", ChatColor.AQUA, true),
|
||||
ALL("", ChatColor.WHITE);
|
||||
TITAN("Titan", ChatColor.RED, true, "Mineplex's fourth premium rank\nBuy Titan at mineplex.com/shop"),
|
||||
LEGEND("Legend", ChatColor.GREEN, true, "Mineplex's third premium rank\nBuy Legend at mineplex.com/shop"),
|
||||
HERO("Hero", ChatColor.LIGHT_PURPLE, true, "Mineplex's second premium rank\nBuy Hero at mineplex.com/shop"),
|
||||
ULTRA("Ultra", ChatColor.AQUA, true, "Mineplex's first premium rank\nBuy Ultra at mineplex.com/shop"),
|
||||
ALL("", ChatColor.WHITE, null);
|
||||
|
||||
private ChatColor _color;
|
||||
private boolean _donor;
|
||||
private String _info;
|
||||
|
||||
public String Name;
|
||||
|
||||
Rank(String name, ChatColor color)
|
||||
Rank(String name, ChatColor color, String info)
|
||||
{
|
||||
_color = color;
|
||||
Name = name;
|
||||
_donor = false;
|
||||
_info = info;
|
||||
}
|
||||
|
||||
Rank(String name, ChatColor color, boolean donor)
|
||||
Rank(String name, ChatColor color, boolean donor, String info)
|
||||
{
|
||||
_color = color;
|
||||
Name = name;
|
||||
_donor = donor;
|
||||
_info = info;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return _info;
|
||||
}
|
||||
|
||||
public boolean has(Rank rank)
|
||||
|
@ -0,0 +1,33 @@
|
||||
package mineplex.core.common.events;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class ServerShutdownEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private JavaPlugin _plugin;
|
||||
|
||||
public ServerShutdownEvent(JavaPlugin plugin)
|
||||
{
|
||||
_plugin = plugin;
|
||||
}
|
||||
|
||||
public JavaPlugin getPlugin()
|
||||
{
|
||||
return _plugin;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class ColorFader {
|
||||
|
||||
private final int _loopsBetween;
|
||||
|
||||
private final List<RGBData> _colors;
|
||||
private final LoopIterator<RGBData> _iterator;
|
||||
private int _loopsSinceLast;
|
||||
|
||||
public ColorFader(int loopsBetweenColors, RGBData... colors)
|
||||
{
|
||||
this(loopsBetweenColors, Arrays.asList(colors));
|
||||
}
|
||||
|
||||
public ColorFader(int loopsBetweenColors, List<RGBData> colors)
|
||||
{
|
||||
_loopsBetween = loopsBetweenColors;
|
||||
|
||||
_colors = new LinkedList<>(colors);
|
||||
_iterator = new LoopIterator<>(_colors);
|
||||
}
|
||||
|
||||
public RGBData next()
|
||||
{
|
||||
RGBData rgb;
|
||||
|
||||
if (_loopsSinceLast >= _loopsBetween)
|
||||
{
|
||||
rgb = _iterator.next();
|
||||
_loopsSinceLast = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int redStep = (_iterator.peekNext().getFullRed() - _iterator.current().getFullRed()) / _loopsBetween;
|
||||
int greenStep = (_iterator.peekNext().getFullGreen() - _iterator.current().getFullGreen()) / _loopsBetween;
|
||||
int blueStep = (_iterator.peekNext().getFullBlue() - _iterator.current().getFullBlue()) / _loopsBetween;
|
||||
|
||||
int red = _iterator.current().getFullRed();
|
||||
int green = _iterator.current().getFullGreen();
|
||||
int blue = _iterator.current().getFullBlue();
|
||||
|
||||
for (int i = 0; i < _loopsSinceLast; i++)
|
||||
{
|
||||
red += redStep;
|
||||
green += greenStep;
|
||||
blue += blueStep;
|
||||
}
|
||||
|
||||
rgb = new RGBData(red, green, blue);
|
||||
}
|
||||
|
||||
_loopsSinceLast++;
|
||||
|
||||
return rgb;
|
||||
}
|
||||
|
||||
}
|
@ -2,6 +2,8 @@ package mineplex.core.common.util;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class F
|
||||
@ -42,9 +44,9 @@ public class F
|
||||
return C.sysHead + head + "> " + C.sysBody + body;
|
||||
}
|
||||
|
||||
public static String elem(String elem)
|
||||
public static String elem(Object elem)
|
||||
{
|
||||
return C.mElem + elem + ChatColor.RESET + C.mBody;
|
||||
return C.mElem + elem.toString() + ChatColor.RESET + C.mBody;
|
||||
}
|
||||
|
||||
public static String name(String elem)
|
||||
@ -198,5 +200,19 @@ public class F
|
||||
return out;
|
||||
}
|
||||
|
||||
public static String vowelAN(String word)
|
||||
{
|
||||
return word.toLowerCase().startsWith("a")
|
||||
|| word.toLowerCase().startsWith("A")
|
||||
|| word.toLowerCase().startsWith("e")
|
||||
|| word.toLowerCase().startsWith("E")
|
||||
|| word.toLowerCase().startsWith("i")
|
||||
|| word.toLowerCase().startsWith("I")
|
||||
|| word.toLowerCase().startsWith("o")
|
||||
|| word.toLowerCase().startsWith("O")
|
||||
|| word.toLowerCase().startsWith("u")
|
||||
|| word.toLowerCase().startsWith("U")
|
||||
? "an" : "a";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,83 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LoopIterator<T>
|
||||
{
|
||||
private List<T> _list;
|
||||
private int _pointer;
|
||||
|
||||
public LoopIterator(List<T> list)
|
||||
{
|
||||
_list = list;
|
||||
}
|
||||
|
||||
public T next()
|
||||
{
|
||||
if (_list.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (++_pointer == _list.size())
|
||||
{
|
||||
_pointer = 0;
|
||||
}
|
||||
|
||||
return _list.get(_pointer);
|
||||
}
|
||||
|
||||
public T peekNext()
|
||||
{
|
||||
if (_list.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int pointer = _pointer;
|
||||
|
||||
if (++pointer == _list.size())
|
||||
{
|
||||
pointer = 0;
|
||||
}
|
||||
|
||||
return _list.get(pointer);
|
||||
}
|
||||
|
||||
public T peekPrev()
|
||||
{
|
||||
if (_list.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int pointer = _pointer;
|
||||
|
||||
if (--pointer < 0)
|
||||
{
|
||||
pointer = _list.size() - 1;
|
||||
}
|
||||
|
||||
return _list.get(pointer);
|
||||
}
|
||||
|
||||
public T prev()
|
||||
{
|
||||
if (_list.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (--_pointer < 0)
|
||||
{
|
||||
_pointer = _list.size() - 1;
|
||||
}
|
||||
|
||||
return _list.get(_pointer);
|
||||
}
|
||||
|
||||
public T current()
|
||||
{
|
||||
return _list.get(_pointer);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
public class NonFinalInteger
|
||||
{
|
||||
private int _value;
|
||||
|
||||
public NonFinalInteger()
|
||||
{
|
||||
this(0);
|
||||
}
|
||||
|
||||
public NonFinalInteger(int value)
|
||||
{
|
||||
_value = value;
|
||||
}
|
||||
|
||||
public NonFinalInteger add(int value)
|
||||
{
|
||||
_value += value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NonFinalInteger subtract(int value)
|
||||
{
|
||||
_value -= value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int get()
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
public class NumericalPulser
|
||||
{
|
||||
private double _min;
|
||||
private double _max;
|
||||
private double _modifyPerCall;
|
||||
|
||||
private double _cur;
|
||||
private boolean _up;
|
||||
|
||||
public NumericalPulser(double min, double max, double modify)
|
||||
{
|
||||
_min = min;
|
||||
_max = max;
|
||||
_modifyPerCall = modify;
|
||||
}
|
||||
|
||||
public double pulse()
|
||||
{
|
||||
if (_up)
|
||||
{
|
||||
_cur = UtilMath.clamp(_cur += _modifyPerCall, _min, _max);
|
||||
|
||||
if (_cur >= _max)
|
||||
{
|
||||
_up = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_cur = UtilMath.clamp(_cur -= _modifyPerCall, _min, _max);
|
||||
|
||||
if (_cur <= _min)
|
||||
{
|
||||
_up = true;
|
||||
}
|
||||
}
|
||||
|
||||
return _cur;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
public class RGBData
|
||||
{
|
||||
private double _red;
|
||||
private double _green;
|
||||
private double _blue;
|
||||
|
||||
public RGBData(int red, int green, int blue)
|
||||
{
|
||||
_red = UtilMath.clamp(((double) red) / 255.d, 0, 1);
|
||||
_green = UtilMath.clamp(((double) green) / 255.d, 0, 1);
|
||||
_blue = UtilMath.clamp(((double) blue) / 255.d, 0, 1);
|
||||
}
|
||||
|
||||
public int getFullRed()
|
||||
{
|
||||
return (int) (_red * 255);
|
||||
}
|
||||
|
||||
public int getFullGreen()
|
||||
{
|
||||
return (int) (_green * 255);
|
||||
}
|
||||
|
||||
public int getFullBlue()
|
||||
{
|
||||
return (int) (_blue * 255);
|
||||
}
|
||||
|
||||
public double getRed()
|
||||
{
|
||||
return _red;
|
||||
}
|
||||
|
||||
public double getGreen()
|
||||
{
|
||||
return _green;
|
||||
}
|
||||
|
||||
public double getBlue()
|
||||
{
|
||||
return _blue;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "RGB["
|
||||
+ "red=" + (int) (_red * 255) + ", "
|
||||
+ "green=" + (int) (_green * 255) + ", "
|
||||
+ "blue=" + (int) (_blue * 255) + "]";
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.EulerAngle;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.EnumDirection;
|
||||
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
|
||||
|
||||
public class UtilAlg
|
||||
{
|
||||
@ -510,4 +510,9 @@ public class UtilAlg
|
||||
Math.toRadians(UtilAlg.GetYaw(vector)),
|
||||
0);
|
||||
}
|
||||
|
||||
public static AxisAlignedBB toBoundingBox(Location a, Location b)
|
||||
{
|
||||
return new AxisAlignedBB(a.getX(), a.getY(), a.getZ(), b.getX(), b.getY(), b.getZ());
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,9 @@ import org.bukkit.ChatColor;
|
||||
*/
|
||||
public class UtilColor
|
||||
{
|
||||
public static final RGBData RgbRed = hexToRgb(0xee0100);
|
||||
public static final RGBData RgbGold = hexToRgb(0xffd014);
|
||||
public static final RGBData RgbLightBlue = hexToRgb(0x61fff7);
|
||||
|
||||
public static byte chatColorToClayData(ChatColor chatColor)
|
||||
{
|
||||
@ -66,4 +69,19 @@ public class UtilColor
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static RGBData hexToRgb(int hex)
|
||||
{
|
||||
return new RGBData(hex >> 16, hex >> 8 & 0xFF, hex & 0xFF);
|
||||
}
|
||||
|
||||
public static int rgbToHex(RGBData rgb)
|
||||
{
|
||||
return (rgb.getFullRed() << 16 | rgb.getFullGreen() << 8 | rgb.getFullBlue());
|
||||
}
|
||||
|
||||
public static int rgbToHex(int red, int green, int blue)
|
||||
{
|
||||
return (red << 16 | green << 8 | blue);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package mineplex.core.common.util;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
@ -116,4 +117,24 @@ public class UtilMath
|
||||
{
|
||||
return num < min ? min : (num > max ? max : num);
|
||||
}
|
||||
|
||||
public static List<Integer> digits(int i) {
|
||||
List<Integer> digits = new ArrayList<Integer>();
|
||||
while(i > 0) {
|
||||
digits.add(i % 10);
|
||||
i /= 10;
|
||||
}
|
||||
return digits;
|
||||
}
|
||||
|
||||
public static double random(double min, double max)
|
||||
{
|
||||
min = Math.abs(min);
|
||||
|
||||
int rand = -random.nextInt((int)(min * 100));
|
||||
|
||||
rand += random.nextInt((int)(max * 100));
|
||||
|
||||
return ((double) rand) / 100.d;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory;
|
||||
|
@ -13,10 +13,12 @@ import mineplex.core.common.CurrencyType;
|
||||
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class UtilText
|
||||
{
|
||||
private static HashMap<Character, Integer> _characters = new HashMap<Character, Integer>();
|
||||
private static HashMap<Character, BufferedImage> _characterImages = new HashMap<Character, BufferedImage>();
|
||||
|
||||
static
|
||||
{
|
||||
@ -296,14 +298,14 @@ public class UtilText
|
||||
{
|
||||
ArrayList<String> strings = new ArrayList<String>();
|
||||
|
||||
//Ignore lines with #
|
||||
// Ignore lines with #
|
||||
if (string.startsWith("#"))
|
||||
{
|
||||
strings.add(string.substring(1, string.length()));
|
||||
return strings;
|
||||
}
|
||||
|
||||
//Empty
|
||||
// Empty
|
||||
if (string.equals("") || string.equals(" "))
|
||||
{
|
||||
strings.add(string);
|
||||
@ -453,35 +455,63 @@ public class UtilText
|
||||
|
||||
private static void grab(Character character, BufferedImage image, int imageX, int imageY)
|
||||
{
|
||||
BufferedImage newImage = image.getSubimage(imageX, imageY, 8, 8);
|
||||
|
||||
int width = 8;
|
||||
|
||||
if (character == ' ')
|
||||
{
|
||||
_characters.put(character, 3);
|
||||
return;
|
||||
width = 3;
|
||||
}
|
||||
|
||||
for (int x = 0; x < 8; x++)
|
||||
else
|
||||
{
|
||||
boolean isTransparentLine = true;
|
||||
|
||||
for (int y = 0; y < 8; y++)
|
||||
for (int x = 0; x < 8; x++)
|
||||
{
|
||||
int pixel = image.getRGB(imageX + x, imageY + y);
|
||||
boolean isTransparentLine = true;
|
||||
|
||||
if ((pixel >> 24) != 0x00)
|
||||
for (int y = 0; y < 8; y++)
|
||||
{
|
||||
isTransparentLine = false;
|
||||
int pixel = image.getRGB(imageX + x, imageY + y);
|
||||
|
||||
if ((pixel >> 24) != 0x00)
|
||||
{
|
||||
isTransparentLine = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isTransparentLine)
|
||||
{
|
||||
width = x + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isTransparentLine)
|
||||
{
|
||||
_characters.put(character, x);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_characters.put(character, 8);
|
||||
newImage = newImage.getSubimage(0, 0, width, 8);
|
||||
|
||||
_characterImages.put(character, newImage);
|
||||
_characters.put(character, width);
|
||||
}
|
||||
|
||||
public static int getLength(char character)
|
||||
{
|
||||
if (!_characters.containsKey(character))
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
return _characters.get(character);
|
||||
}
|
||||
|
||||
public static BufferedImage getImage(char character)
|
||||
{
|
||||
if (!_characterImages.containsKey(character))
|
||||
{
|
||||
character = '?';
|
||||
}
|
||||
|
||||
return _characterImages.get(character);
|
||||
}
|
||||
|
||||
public static boolean isStringSimilar(String newString, String oldString, float matchRequirement)
|
||||
@ -622,4 +652,27 @@ public class UtilText
|
||||
return arrayToString(array, null);
|
||||
}
|
||||
|
||||
public static String getProgress(String prefix, double amount, String suffix, boolean progressDirectionSwap)
|
||||
{
|
||||
if (progressDirectionSwap)
|
||||
amount = 1 - amount;
|
||||
|
||||
//Generate Bar
|
||||
int bars = 24;
|
||||
String progressBar = C.cGreen + "";
|
||||
boolean colorChange = false;
|
||||
for (int i=0 ; i<bars ; i++)
|
||||
{
|
||||
if (!colorChange && (float)i/(float)bars >= amount)
|
||||
{
|
||||
progressBar += C.cRed;
|
||||
colorChange = true;
|
||||
}
|
||||
|
||||
progressBar += "▌";
|
||||
}
|
||||
|
||||
return(prefix == null ? "" : prefix + ChatColor.RESET + " ") + progressBar + (suffix == null ? "" : ChatColor.RESET + " " + suffix);
|
||||
}
|
||||
|
||||
}
|
@ -31,6 +31,12 @@ public class UtilTime
|
||||
return sdf.format(cal.getTime());
|
||||
}
|
||||
|
||||
public static String date(long date)
|
||||
{
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_DAY);
|
||||
return sdf.format(date);
|
||||
}
|
||||
|
||||
public static String getDayOfMonthSuffix(final int n)
|
||||
{
|
||||
if (n >= 11 && n <= 13) {
|
||||
|
@ -135,6 +135,11 @@ public class CoreClientManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
public boolean Contains(String name)
|
||||
{
|
||||
return _clientList.containsKey(name);
|
||||
}
|
||||
|
||||
public CoreClient Get(Player player)
|
||||
{
|
||||
return Get(player.getName());
|
||||
@ -285,6 +290,76 @@ public class CoreClientManager extends MiniPlugin
|
||||
});
|
||||
}
|
||||
|
||||
public void loadClientByNameSync(final String playerName, final Runnable runnable)
|
||||
{
|
||||
try
|
||||
{
|
||||
ClientToken token = null;
|
||||
Gson gson = new Gson();
|
||||
|
||||
// Fails if not in DB and if duplicate.
|
||||
UUID uuid = loadUUIDFromDB(playerName);
|
||||
|
||||
if (uuid == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
uuid = UUIDFetcher.getUUIDOf(playerName);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
System.out.println("Error fetching uuid from mojang : " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
String response = "";
|
||||
|
||||
if (uuid == null)
|
||||
{
|
||||
response = _repository.getClientByName(playerName);
|
||||
}
|
||||
else
|
||||
{
|
||||
response = _repository.getClientByUUID(uuid);
|
||||
}
|
||||
|
||||
token = gson.fromJson(response, ClientToken.class);
|
||||
|
||||
CoreClient client = Add(playerName);
|
||||
client.SetRank(Rank.valueOf(token.Rank), false);
|
||||
client.setAccountId(_repository.login(_loginProcessors, _querylessLoginProcessors, uuid.toString(), client.GetPlayerName()));
|
||||
|
||||
// JSON sql response
|
||||
Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid));
|
||||
|
||||
if (client.getAccountId() > 0)
|
||||
{
|
||||
PlayerInfo playerInfo = PlayerCache.getInstance().getPlayer(uuid);
|
||||
|
||||
if (playerInfo != null)
|
||||
{
|
||||
playerInfo.setAccountId(client.getAccountId());
|
||||
PlayerCache.getInstance().addPlayer(playerInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (runnable != null)
|
||||
runnable.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public boolean LoadClient(final CoreClient client, final UUID uuid, String ipAddress)
|
||||
{
|
||||
TimingManager.start(client.GetPlayerName() + " LoadClient Total.");
|
||||
|
@ -81,7 +81,7 @@ public class StatDisplay
|
||||
formattedStats[i] = gameDisplay.getName() + "." + stats[i];
|
||||
}
|
||||
|
||||
return new StatDisplay(name, true, formattedStats);
|
||||
return new StatDisplay(name, true, false, formattedStats);
|
||||
}
|
||||
|
||||
public static final StatDisplay WINS = new StatDisplay("Wins");
|
||||
|
@ -440,6 +440,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
incrementDailyStreak(player);
|
||||
awardBonus(player, amount);
|
||||
updateCreeperVisual(player, true, C.cAqua);
|
||||
UtilPlayer.message(player, F.main("Carl", "Come back tomorrow for more!"));
|
||||
|
||||
_statsManager.incrementStat(player, "Global.DailyReward", 1);
|
||||
}
|
||||
@ -481,6 +482,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
{
|
||||
awardBonus(player, getRankBonusAmount(player));
|
||||
updateCreeperVisual(player, true, C.cAqua);
|
||||
UtilPlayer.message(player, F.main("Carl", "Come back next month for more!"));
|
||||
}
|
||||
|
||||
result.run(aBoolean);
|
||||
@ -814,9 +816,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
_statsManager.incrementStat(player, "Global.ExpEarned", experience);
|
||||
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(experience + " Experience")));
|
||||
}
|
||||
|
||||
UtilPlayer.message(player, F.main("Carl", "Come back tomorrow for more!"));
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -296,7 +296,7 @@ public class Chat extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void HandleChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
|
@ -48,10 +48,15 @@ public class CustomDataManager extends MiniDbClientPlugin<PlayerCustomData>
|
||||
return new PlayerCustomData(_repository);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData(String name, int accountId)
|
||||
public void saveAsync(Player player)
|
||||
{
|
||||
_repository.saveData(name, accountId);
|
||||
final int accountId = getClientManager().getAccountId(player);
|
||||
final String name = player.getName();
|
||||
|
||||
if (accountId == -1)
|
||||
return;
|
||||
|
||||
runAsync(() -> _repository.saveData(name, accountId));
|
||||
}
|
||||
|
||||
public CorePlayer getCorePlayer(Player player)
|
||||
|
@ -27,10 +27,11 @@ public abstract class MineplexPlayer
|
||||
return "";
|
||||
}
|
||||
|
||||
public void put(String key, int data)
|
||||
public void put(String key, int data, boolean save)
|
||||
{
|
||||
key = getKeyPrefix() + key;
|
||||
_customDataManager.Get(getPlayer()).setData(key, data);
|
||||
if (save) _customDataManager.saveAsync(_player);
|
||||
}
|
||||
|
||||
public int get(String key)
|
||||
|
@ -3,6 +3,7 @@ package mineplex.core.customdata.repository;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -71,20 +72,20 @@ public class CustomDataRepository extends RepositoryBase
|
||||
{
|
||||
PlayerCustomData data = _customDataManager.Get(name);
|
||||
|
||||
for (CustomData cd : data.getDataMap().keySet())
|
||||
for (Map.Entry<CustomData, Integer> entry : data.getDataMap().entrySet())
|
||||
{
|
||||
if (executeUpdate(
|
||||
UPDATE_DATA,
|
||||
new ColumnInt("data", data.getDataMap().get(cd)),
|
||||
new ColumnInt("data", entry.getValue()),
|
||||
new ColumnInt("account", accountId),
|
||||
new ColumnInt("customData", cd.getId())) < 1)
|
||||
new ColumnInt("customData", entry.getKey().getId())) < 1)
|
||||
{
|
||||
// Not already in the DB
|
||||
executeUpdate(
|
||||
INSERT_DATA,
|
||||
new ColumnInt("account", accountId),
|
||||
new ColumnInt("customData", cd.getId()),
|
||||
new ColumnInt("data", data.getDataMap().get(cd))
|
||||
new ColumnInt("customData", entry.getKey().getId()),
|
||||
new ColumnInt("data", entry.getValue())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,65 @@
|
||||
package mineplex.core.delayedtask;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class DelayedTask extends MiniClientPlugin<DelayedTaskClient>
|
||||
{
|
||||
public static DelayedTask Instance;
|
||||
|
||||
public DelayedTask(JavaPlugin plugin)
|
||||
{
|
||||
super("Delayed Task", plugin);
|
||||
}
|
||||
|
||||
public static void Initialize(JavaPlugin plugin)
|
||||
{
|
||||
Instance = new DelayedTask(plugin);
|
||||
}
|
||||
|
||||
public void doDelay(Player player, String task, Callback<DelayedTaskClient> end, Callback<DelayedTaskClient> tick, Callback<DelayedTaskClient> cancel, long wait, boolean allowMovement)
|
||||
{
|
||||
Get(player).insert(new Task(Get(player), task, end, tick, cancel, wait, allowMovement));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
Get(player).tick();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
Get(event.getPlayer()).cleanup();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerKick(PlayerKickEvent event)
|
||||
{
|
||||
Get(event.getPlayer()).cleanup();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DelayedTaskClient AddPlayer(String player)
|
||||
{
|
||||
return new DelayedTaskClient(Bukkit.getPlayer(player));
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package mineplex.core.delayedtask;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class DelayedTaskClient
|
||||
{
|
||||
public Map<String, Task> Tasks = new HashMap<>();
|
||||
|
||||
private Player _player;
|
||||
|
||||
public DelayedTaskClient(Player player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
public void insert(Task task)
|
||||
{
|
||||
Tasks.put(task.getName(), task);
|
||||
}
|
||||
|
||||
public long getTimeLeft(String task)
|
||||
{
|
||||
if (!Tasks.containsKey(task)) return -1;
|
||||
|
||||
return getEndTime(task) - System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public long getEndTime(String task)
|
||||
{
|
||||
if (!Tasks.containsKey(task)) return -1;
|
||||
|
||||
return Tasks.get(task).getEndTime();
|
||||
}
|
||||
|
||||
public long getStartTime(String task)
|
||||
{
|
||||
if (!Tasks.containsKey(task)) return -1;
|
||||
|
||||
return Tasks.get(task).getStartTime();
|
||||
}
|
||||
|
||||
public void cleanup()
|
||||
{
|
||||
if (Tasks == null)
|
||||
{
|
||||
Tasks = new HashMap<>();
|
||||
}
|
||||
|
||||
Tasks.clear();
|
||||
Tasks = null;
|
||||
}
|
||||
|
||||
public void cleanup(String task)
|
||||
{
|
||||
Tasks.remove(task);
|
||||
}
|
||||
|
||||
public void tick()
|
||||
{
|
||||
if (Tasks == null)
|
||||
{
|
||||
Tasks = new HashMap<>();
|
||||
}
|
||||
|
||||
for (Task task : Tasks.values())
|
||||
{
|
||||
if (task.getTick() != null)
|
||||
{
|
||||
task.tick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
package mineplex.core.delayedtask;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
import mineplex.core.common.util.Callback;
|
||||
|
||||
public class Task
|
||||
{
|
||||
private DelayedTaskClient _client;
|
||||
|
||||
private Callback<DelayedTaskClient> _end;
|
||||
private Callback<DelayedTaskClient> _tick;
|
||||
private Callback<DelayedTaskClient> _cancel;
|
||||
|
||||
private String _name;
|
||||
|
||||
private long _startTime;
|
||||
private long _endTime;
|
||||
|
||||
private Location _startPos;
|
||||
private boolean _allowMovement;
|
||||
|
||||
public Task(DelayedTaskClient client, String task, Callback<DelayedTaskClient> end, Callback<DelayedTaskClient> tick, Callback<DelayedTaskClient> cancel, long taskLength, boolean allowMovement)
|
||||
{
|
||||
_client = client;
|
||||
|
||||
_name = task;
|
||||
_end = end;
|
||||
_tick = tick;
|
||||
_cancel = cancel;
|
||||
|
||||
_startPos = client.getPlayer().getLocation();
|
||||
|
||||
_allowMovement = allowMovement;
|
||||
|
||||
_startTime = System.currentTimeMillis();
|
||||
_endTime = _startTime + taskLength;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public Callback<DelayedTaskClient> getEnd()
|
||||
{
|
||||
return _end;
|
||||
}
|
||||
|
||||
public Callback<DelayedTaskClient> getTick()
|
||||
{
|
||||
return _tick;
|
||||
}
|
||||
|
||||
public long getEndTime()
|
||||
{
|
||||
return _endTime;
|
||||
}
|
||||
|
||||
public long getStartTime()
|
||||
{
|
||||
return _startTime;
|
||||
}
|
||||
|
||||
public void tick()
|
||||
{
|
||||
_tick.run(_client);
|
||||
|
||||
if (!_allowMovement && _startPos.distance(_client.getPlayer().getLocation()) > 0.3)
|
||||
{
|
||||
if (_cancel != null)
|
||||
{
|
||||
_cancel.run(_client);
|
||||
}
|
||||
|
||||
_client.cleanup(_name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() >= _endTime)
|
||||
{
|
||||
if (_end != null)
|
||||
{
|
||||
_end.run(_client);
|
||||
}
|
||||
|
||||
_client.cleanup(_name);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package mineplex.core.disguise;
|
||||
|
||||
import mineplex.serverdata.data.Data;
|
||||
|
||||
public class DisguisePlayerBean implements Data
|
||||
{
|
||||
private int _accountID;
|
||||
private String _disguisedPlayer;
|
||||
private String _playerName;
|
||||
public DisguisePlayerBean(int playerAccountID, String playerName, String disguiseAs)
|
||||
{
|
||||
this._accountID = playerAccountID;
|
||||
this._disguisedPlayer = disguiseAs;
|
||||
this._playerName = playerName;
|
||||
|
||||
}
|
||||
public int getAccountID()
|
||||
{
|
||||
return _accountID;
|
||||
}
|
||||
public String getDisguisedPlayer()
|
||||
{
|
||||
return _disguisedPlayer;
|
||||
}
|
||||
public String getPlayerName()
|
||||
{
|
||||
return _playerName;
|
||||
}
|
||||
@Override
|
||||
public String getDataId()
|
||||
{
|
||||
return _accountID+_playerName;
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package mineplex.core.disguise;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.serverdata.Region;
|
||||
import mineplex.serverdata.redis.RedisDataRepository;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class PlayerDisguiseManager extends MiniPlugin
|
||||
{
|
||||
private CoreClientManager _clients;
|
||||
private RedisDataRepository<DisguisePlayerBean> _redis;
|
||||
public PlayerDisguiseManager(JavaPlugin plugin, CoreClientManager clients)
|
||||
{
|
||||
super("Player Disguise Manager", plugin);
|
||||
this._clients = clients;
|
||||
|
||||
_redis = new RedisDataRepository<DisguisePlayerBean>(Region.ALL, DisguisePlayerBean.class, "disguisedPlayer");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDisguisedPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
CoreClient client = _clients.Get(event.getPlayer());
|
||||
if(client.isDisguised())
|
||||
{
|
||||
_redis.addElement(new DisguisePlayerBean(client.getAccountId(), client.GetPlayerName(), client.getDisguisedAs()), 60*60*12); // 12 hours
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDisguisedPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
CoreClient client = _clients.Get(event.getPlayer());
|
||||
|
||||
if(!client.GetRank().has(Rank.JNR_DEV) && client.GetRank() != Rank.YOUTUBE_SMALL && client.GetRank() != Rank.TWITCH && client.GetRank() != Rank.YOUTUBE)
|
||||
return;
|
||||
|
||||
if(_redis.elementExists(client.getAccountId()+client.GetPlayerName()))
|
||||
{
|
||||
DisguisePlayerBean bean = _redis.getElement(client.getAccountId()+client.GetPlayerName());
|
||||
Bukkit.getPluginManager().callEvent(new PlayerCommandPreprocessEvent(event.getPlayer(), "/Disguise " + bean.getDisguisedPlayer()));
|
||||
event.setJoinMessage("");
|
||||
}
|
||||
}
|
||||
}.runTaskLater(getPlugin(), 7);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerUndisguise(PlayerUndisguiseEvent event)
|
||||
{
|
||||
CoreClient client = _clients.Get(event.getPlayer());
|
||||
_redis.removeElement(client.getAccountId()+client.GetPlayerName());
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package mineplex.core.disguise;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class PlayerUndisguiseEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Player _player;
|
||||
public PlayerUndisguiseEvent(Player disguisee)
|
||||
{
|
||||
this._player = disguisee;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -21,6 +21,7 @@ import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.donation.command.CoinCommand;
|
||||
import mineplex.core.donation.command.GemCommand;
|
||||
import mineplex.core.donation.command.GoldCommand;
|
||||
import mineplex.core.donation.command.SetGoldCommand;
|
||||
import mineplex.core.donation.repository.DonationRepository;
|
||||
import mineplex.core.donation.repository.token.DonorTokenWrapper;
|
||||
import mineplex.core.server.util.TransactionResponse;
|
||||
@ -49,6 +50,7 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
|
||||
addCommand(new GemCommand(this));
|
||||
addCommand(new CoinCommand(this));
|
||||
addCommand(new GoldCommand(this));
|
||||
addCommand(new SetGoldCommand(this));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -336,6 +338,35 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
|
||||
}, caller, name, accountId, amount);
|
||||
}
|
||||
|
||||
public void setGold(final Callback<Boolean> callback, final String caller, final String name, final int accountId, final int amount, final boolean updateTotal)
|
||||
{
|
||||
_repository.setGold(new Callback<Boolean>()
|
||||
{
|
||||
public void run(Boolean success)
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
if (updateTotal)
|
||||
{
|
||||
Donor donor = Get(name);
|
||||
|
||||
if (donor != null)
|
||||
{
|
||||
donor.setGold(amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("SET GOLD FAILED...");
|
||||
}
|
||||
|
||||
if (callback != null)
|
||||
callback.run(success);
|
||||
}
|
||||
}, caller, name, accountId, amount);
|
||||
}
|
||||
|
||||
public void RewardGoldLater(final String caller, final Player player, final int amount)
|
||||
{
|
||||
if (!_goldQueue.containsKey(player))
|
||||
@ -414,7 +445,7 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
|
||||
@Override
|
||||
public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException
|
||||
{
|
||||
Get(playerName).addGold(_repository.retrieveDonorInfo(resultSet).getGold());
|
||||
Get(playerName).setGold(_repository.retrieveDonorInfo(resultSet).getGold());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -152,7 +152,11 @@ public class Donor
|
||||
public void addGold(int amount)
|
||||
{
|
||||
_gold = Math.max(0, _gold + amount);
|
||||
}
|
||||
|
||||
public void setGold(int amount)
|
||||
{
|
||||
_gold = Math.max(0, amount);
|
||||
}
|
||||
|
||||
public List<CoinTransactionToken> getCoinTransactions()
|
||||
|
@ -0,0 +1,75 @@
|
||||
package mineplex.core.donation.command;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SetGoldCommand extends CommandBase<DonationManager>
|
||||
{
|
||||
public SetGoldCommand(DonationManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, "setgold");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Error! Usage: " + F.elem("/setgold <player> <amount>")));
|
||||
return;
|
||||
}
|
||||
|
||||
final String targetName = args[0];
|
||||
final String goldString = args[1];
|
||||
Player target = UtilPlayer.searchExact(targetName);
|
||||
|
||||
try
|
||||
{
|
||||
if (target == null)
|
||||
{
|
||||
Plugin.getClientManager().loadClientByName(targetName, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
CoreClient client = Plugin.getClientManager().Get(targetName);
|
||||
|
||||
if (client != null)
|
||||
{
|
||||
setGold(caller, null, targetName, client.getAccountId(), Integer.parseInt(goldString));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Gold", "Could not find player " + F.name(targetName)));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
setGold(caller, target, target.getName(), Plugin.getClientManager().Get(target).getAccountId(), Integer.parseInt(goldString));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(target, F.main("Clans", "You must provide a valid number in the gold parameter."));
|
||||
}
|
||||
}
|
||||
|
||||
private void setGold(final Player caller, final Player target, final String targetName, final int accountId, final int gold)
|
||||
{
|
||||
Plugin.setGold(new Callback<Boolean>()
|
||||
{
|
||||
public void run(Boolean completed)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Gold", "You set " + F.name(targetName) + "'s Gold to " + F.elem(gold) + "."));
|
||||
}
|
||||
}, caller.getName(), targetName, accountId, gold, true);
|
||||
}
|
||||
}
|
@ -31,6 +31,7 @@ public class DonationRepository extends RepositoryBase
|
||||
private static String INSERT_COIN_TRANSACTION = "INSERT INTO accountCoinTransactions(accountId, reason, coins) VALUES(?, ?, ?);";
|
||||
private static String UPDATE_ACCOUNT_COINS = "UPDATE accounts SET coins = coins + ? WHERE id = ?;";
|
||||
private static String UPDATE_ACCOUNT_GOLD = "UPDATE accounts SET gold = gold + ? WHERE id = ?;";
|
||||
private static String SET_ACCOUNT_GOLD = "UPDATE accounts SET gold = ? WHERE id = ?;";
|
||||
private static String UPDATE_NULL_ACCOUNT_GEMS_AND_COINS_ = "UPDATE accounts SET gems = ?, coins = ? WHERE id = ? AND gems IS NULL AND coins IS NULL;";
|
||||
|
||||
private String _webAddress;
|
||||
@ -199,6 +200,18 @@ public class DonationRepository extends RepositoryBase
|
||||
}), "Error updating player gold amount in DonationRepository : ");
|
||||
}
|
||||
|
||||
public void setGold(final Callback<Boolean> callback, final String giver, final String name, final int accountId, final int gold)
|
||||
{
|
||||
handleDatabaseCall(new DatabaseRunnable(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
boolean success = executeUpdate(SET_ACCOUNT_GOLD, new ColumnInt("gold", gold), new ColumnInt("id", accountId)) > 0;
|
||||
callback.run(success);
|
||||
}
|
||||
}), "Error updating player gold amount in DonationRepository : ");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize()
|
||||
{
|
||||
@ -233,7 +246,7 @@ public class DonationRepository extends RepositoryBase
|
||||
|
||||
while (resultSet.next())
|
||||
{
|
||||
donor.addGold(resultSet.getInt(1));
|
||||
donor.setGold(resultSet.getInt(1));
|
||||
}
|
||||
|
||||
return donor;
|
||||
|
@ -131,6 +131,20 @@ public class ItemBatGun extends ItemGadget
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isThrownBat(Bat bat)
|
||||
{
|
||||
for (ArrayList<Bat> batArray : _bats.values())
|
||||
{
|
||||
for (Bat thrownBat : batArray)
|
||||
{
|
||||
if (bat.equals(thrownBat))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Clear(Player player)
|
||||
{
|
||||
_active.remove(player);
|
||||
|
@ -22,7 +22,7 @@ public class ItemDuelingSword extends ItemGadget
|
||||
},
|
||||
-3,
|
||||
Material.GOLD_SWORD, (byte)0,
|
||||
1000, new Ammo("Dueling Sword", "10 Swords", Material.WOOD_SWORD, (byte)0, new String[] { C.cWhite + "10 Swords to duel with" }, 1000, 10));
|
||||
1000, new Ammo("Dueling Sword", "10 Swords", Material.WOOD_SWORD, (byte)0, new String[] { C.cWhite + "10 Swords to duel with" }, 1000, 10), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,6 +27,7 @@ import mineplex.core.recharge.Recharge;
|
||||
|
||||
public abstract class ItemGadget extends Gadget
|
||||
{
|
||||
private boolean _preserveStaticItem;
|
||||
private Ammo _ammo;
|
||||
protected long _recharge;
|
||||
|
||||
@ -40,6 +41,14 @@ public abstract class ItemGadget extends Gadget
|
||||
Free = true;
|
||||
}
|
||||
|
||||
public ItemGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data,
|
||||
long recharge, Ammo ammo, boolean preserveStaticItem)
|
||||
{
|
||||
this(manager, name, desc, cost, mat, data, recharge, ammo);
|
||||
|
||||
_preserveStaticItem = preserveStaticItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EnableCustom(Player player)
|
||||
{
|
||||
@ -84,6 +93,9 @@ public abstract class ItemGadget extends Gadget
|
||||
{
|
||||
if (IsActive(event.getPlayer()) && event.getItemDrop().getItemStack().getType() == GetDisplayMaterial())
|
||||
{
|
||||
if (_preserveStaticItem)
|
||||
return;
|
||||
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
|
||||
|
@ -173,6 +173,7 @@ public class ItemBuilder
|
||||
{
|
||||
for (String lore : lores)
|
||||
{
|
||||
if (lore == null) continue;
|
||||
_lore.add(C.cGray + lore);
|
||||
}
|
||||
|
||||
|
@ -2,14 +2,9 @@ package mineplex.core.map;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@ -20,86 +15,6 @@ import org.bukkit.map.MapView;
|
||||
|
||||
public class MapText
|
||||
{
|
||||
private static HashMap<Character, BufferedImage> _characters = new HashMap<Character, BufferedImage>();
|
||||
|
||||
private void loadCharacters()
|
||||
{
|
||||
try
|
||||
{
|
||||
InputStream inputStream = getClass().getResourceAsStream("ascii.png");
|
||||
BufferedImage image = ImageIO.read(inputStream);
|
||||
|
||||
char[] text = new char[]
|
||||
{
|
||||
' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4',
|
||||
'5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
|
||||
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^',
|
||||
'_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
|
||||
't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~'
|
||||
};
|
||||
|
||||
int x = 0;
|
||||
int y = 16;
|
||||
|
||||
for (char c : text)
|
||||
{
|
||||
grab(c, image, x, y);
|
||||
|
||||
if (x < 15 * 8)
|
||||
{
|
||||
x += 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y += 8;
|
||||
}
|
||||
}
|
||||
|
||||
inputStream.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void grab(Character character, BufferedImage image, int imageX, int imageY)
|
||||
{
|
||||
BufferedImage newImage = image.getSubimage(imageX, imageY, 8, 8);
|
||||
|
||||
int width = character == ' ' ? 4 : 0;
|
||||
|
||||
if (width == 0)
|
||||
{
|
||||
for (int x = 0; x < 8; x++)
|
||||
{
|
||||
width++;
|
||||
boolean foundNonTrans = false;
|
||||
|
||||
for (int y = 0; y < 8; y++)
|
||||
{
|
||||
int pixel = newImage.getRGB(x, y);
|
||||
|
||||
if ((pixel >> 24) != 0x00)
|
||||
{
|
||||
foundNonTrans = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundNonTrans)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newImage = newImage.getSubimage(0, 0, width, 8);
|
||||
|
||||
_characters.put(character, newImage);
|
||||
}
|
||||
|
||||
private ArrayList<String> split(String text)
|
||||
{
|
||||
ArrayList<String> returns = new ArrayList<String>();
|
||||
@ -112,7 +27,7 @@ public class MapText
|
||||
|
||||
for (char c : word.toCharArray())
|
||||
{
|
||||
length += _characters.get(c).getWidth();
|
||||
length += UtilText.getImage(c).getWidth();
|
||||
}
|
||||
|
||||
if (lineWidth + length >= 127)
|
||||
@ -133,11 +48,6 @@ public class MapText
|
||||
|
||||
public ItemStack getMap(boolean sendToServer, String... text)
|
||||
{
|
||||
if (_characters.isEmpty())
|
||||
{
|
||||
loadCharacters();
|
||||
}
|
||||
|
||||
BufferedImage image = new BufferedImage(128, 128, BufferedImage.TYPE_INT_RGB);
|
||||
Graphics g = image.getGraphics();
|
||||
int height = 1;
|
||||
@ -150,13 +60,7 @@ public class MapText
|
||||
|
||||
for (char c : line.toCharArray())
|
||||
{
|
||||
BufferedImage img = _characters.get(c);
|
||||
|
||||
if (img == null)
|
||||
{
|
||||
System.out.print("Error: '" + c + "' has no image associated");
|
||||
continue;
|
||||
}
|
||||
BufferedImage img = UtilText.getImage(c);
|
||||
|
||||
g.drawImage(img, length, height, null);
|
||||
|
||||
|
@ -10,6 +10,7 @@ import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.message.MessageManager;
|
||||
import mineplex.core.visibility.VisibilityManager;
|
||||
|
||||
public class AdminCommand extends CommandBase<MessageManager>
|
||||
{
|
||||
@ -53,6 +54,11 @@ public class AdminCommand extends CommandBase<MessageManager>
|
||||
if (!to.equals(caller))
|
||||
UtilPlayer.message(to, F.rank(Plugin.GetClientManager().Get(caller).GetRank()) + " " + caller.getName() + " " + C.cPurple + message);
|
||||
|
||||
if(Plugin.GetClientManager().Get(to).GetRank().has(Rank.JNR_DEV))
|
||||
{
|
||||
if(Plugin.GetClientManager().Get(to).isDisguised() || !caller.canSee(to))
|
||||
continue;
|
||||
}
|
||||
staff = true;
|
||||
|
||||
//Sound
|
||||
|
@ -52,8 +52,8 @@ public class NotificationManager extends MiniPlugin
|
||||
// if (event.getType() == UpdateType.MIN_16)
|
||||
// sale();
|
||||
|
||||
if (event.getType() == UpdateType.MIN_08)
|
||||
christmasSale();
|
||||
// if (event.getType() == UpdateType.MIN_08)
|
||||
// christmasSale();
|
||||
}
|
||||
|
||||
private void christmasSale()
|
||||
|
@ -132,6 +132,12 @@ public class ExclusivePreferencesPage extends ShopPageBase<PreferencesManager, E
|
||||
buildPreference(indices[1], Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);
|
||||
buildPreference(indices[2], Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
|
||||
}
|
||||
else if (rank == Rank.YOUTUBE_SMALL)
|
||||
{
|
||||
int[] indices = UtilUI.getIndicesFor(2, 0, 2);
|
||||
buildPreference(indices[0], Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);
|
||||
buildPreference(indices[1], Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleHubForcefield(org.bukkit.entity.Player player)
|
||||
|
@ -231,7 +231,7 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
|
||||
if (rank.has(Rank.ULTRA))
|
||||
buildPreference(indices[8], Material.BARRIER, "Disable Ads", userPreferences.DisableAds, _toggleDisableAds);
|
||||
|
||||
if (rank.has(Rank.MODERATOR) || rank == Rank.YOUTUBE || rank == Rank.TWITCH)
|
||||
if (rank.has(Rank.MODERATOR) || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.YOUTUBE_SMALL)
|
||||
{
|
||||
addButton(53, new ShopItem(Material.DIAMOND, (byte) 0, C.cAqua + "Exclusive Preferences", new String[]{C.cGold + "This will open a page of preferences", C.cGold + "that are only available to you."}, 1, false, false), new IButton()
|
||||
{
|
||||
|
@ -2,6 +2,20 @@ package mineplex.core.punish;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.ClientWebResponseEvent;
|
||||
@ -20,18 +34,6 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.serverdata.commands.ServerCommandManager;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import com.google.gson.Gson;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Punish extends MiniPlugin
|
||||
{
|
||||
private HashMap<String, PunishClient> _punishClients;
|
||||
@ -110,6 +112,18 @@ public class Punish extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void PunishSignEvent(SignChangeEvent event)
|
||||
{
|
||||
PunishClient client = GetClient(event.getPlayer().getName());
|
||||
|
||||
if (client != null && client.IsMuted())
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main(getName(), "Shh, you're muted because " + client.GetPunishment(PunishmentSentence.Mute).GetReason() + " by " + client.GetPunishment(PunishmentSentence.Mute).GetAdmin() + " for " + C.cGreen + UtilTime.convertString(client.GetPunishment(PunishmentSentence.Mute).GetRemaining(), 1, TimeUnit.FIT) + "."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void banRefresh(UpdateEvent event)
|
||||
{
|
||||
|
@ -15,6 +15,7 @@ import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.stats.command.GiveStatCommand;
|
||||
import mineplex.core.stats.command.MasterBuilderUnban;
|
||||
import mineplex.core.stats.command.TimeCommand;
|
||||
import mineplex.core.stats.event.StatChangeEvent;
|
||||
|
||||
@ -26,6 +27,8 @@ public class StatsManager extends MiniDbClientPlugin<PlayerStats>
|
||||
|
||||
private NautHashMap<String, Integer> _stats = new NautHashMap<String, Integer>();
|
||||
private NautHashMap<Player, NautHashMap<String, Long>> _statUploadQueue = new NautHashMap<Player, NautHashMap<String, Long>>();
|
||||
private NautHashMap<Player, NautHashMap<String, Long>> _statUploadQueueOverRidable = new NautHashMap<Player, NautHashMap<String, Long>>();
|
||||
|
||||
private Runnable _saveRunnable;
|
||||
|
||||
public StatsManager(JavaPlugin plugin, CoreClientManager clientManager)
|
||||
@ -41,6 +44,7 @@ public class StatsManager extends MiniDbClientPlugin<PlayerStats>
|
||||
public void run()
|
||||
{
|
||||
saveStats();
|
||||
overRidableSaveStats();
|
||||
}
|
||||
};
|
||||
|
||||
@ -81,6 +85,11 @@ public class StatsManager extends MiniDbClientPlugin<PlayerStats>
|
||||
}
|
||||
|
||||
public void incrementStat(final Player player, final String statName, final long value)
|
||||
{
|
||||
incrementStat(player, statName, value, false);
|
||||
}
|
||||
|
||||
public void incrementStat(final Player player, final String statName, final long value, boolean overRide)
|
||||
{
|
||||
if (value <= 0)
|
||||
return;
|
||||
@ -96,11 +105,80 @@ public class StatsManager extends MiniDbClientPlugin<PlayerStats>
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
addToQueue(statName, player, value);
|
||||
if(overRide)
|
||||
{
|
||||
addToOverRidableQueue(statName, player, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
addToQueue(statName, player, value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addToOverRidableQueue(String statName, Player player, long value)
|
||||
{
|
||||
synchronized (_statSync)
|
||||
{
|
||||
if (!_statUploadQueueOverRidable.containsKey(player))
|
||||
_statUploadQueueOverRidable.put(player, new NautHashMap<String, Long>());
|
||||
|
||||
if (!_statUploadQueueOverRidable.get(player).containsKey(statName))
|
||||
_statUploadQueueOverRidable.get(player).put(statName, 0L);
|
||||
|
||||
_statUploadQueueOverRidable.get(player).put(statName, _statUploadQueueOverRidable.get(player).get(statName) + value);
|
||||
}
|
||||
}
|
||||
|
||||
protected void overRidableSaveStats()
|
||||
{
|
||||
if (_statUploadQueueOverRidable.isEmpty())
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
NautHashMap<Integer, NautHashMap<Integer, Long>> uploadQueue = new NautHashMap<Integer, NautHashMap<Integer, Long>>();
|
||||
|
||||
synchronized (_statSync)
|
||||
{
|
||||
for (Iterator<Player> statIterator = _statUploadQueueOverRidable.keySet().iterator(); statIterator.hasNext();)
|
||||
{
|
||||
Player player = statIterator.next();
|
||||
|
||||
if (player.isOnline())
|
||||
continue;
|
||||
|
||||
try
|
||||
{
|
||||
int uploadKey = PlayerCache.getInstance().getPlayer(player.getUniqueId()).getAccountId();
|
||||
|
||||
uploadQueue.put(uploadKey, new NautHashMap<Integer, Long>());
|
||||
|
||||
for (String statName : _statUploadQueueOverRidable.get(player).keySet())
|
||||
{
|
||||
int statId = _stats.get(statName);
|
||||
uploadQueue.get(uploadKey).put(statId, _statUploadQueueOverRidable.get(player).get(statName));
|
||||
System.out.println(player.getName() + " saving stat : " + statName + " overriding " + _statUploadQueueOverRidable.get(player).get(statName));
|
||||
}
|
||||
|
||||
statIterator.remove();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//System.out.println("[StatsManager] AccountId was not set for " + player.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_repository.saveStats(uploadQueue, true);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void addToQueue(String statName, Player player, long value)
|
||||
{
|
||||
synchronized (_statSync)
|
||||
@ -164,6 +242,11 @@ public class StatsManager extends MiniDbClientPlugin<PlayerStats>
|
||||
}
|
||||
|
||||
public boolean incrementStat(final int accountId, final String statName, final long value)
|
||||
{
|
||||
return incrementStat(accountId, statName, value, false);
|
||||
}
|
||||
|
||||
public boolean incrementStat(final int accountId, final String statName, final long value, boolean overRide)
|
||||
{
|
||||
// This will register a new stat if we don't have one, otherwise it will just run the callback
|
||||
registerNewStat(statName, new Runnable()
|
||||
@ -175,7 +258,7 @@ public class StatsManager extends MiniDbClientPlugin<PlayerStats>
|
||||
uploadQueue.put(accountId, new NautHashMap<Integer, Long>());
|
||||
uploadQueue.get(accountId).put(_stats.get(statName), value);
|
||||
|
||||
_repository.saveStats(uploadQueue);
|
||||
_repository.saveStats(uploadQueue, overRide);
|
||||
}
|
||||
});
|
||||
|
||||
@ -237,6 +320,7 @@ public class StatsManager extends MiniDbClientPlugin<PlayerStats>
|
||||
{
|
||||
addCommand(new TimeCommand(this));
|
||||
addCommand(new GiveStatCommand(this));
|
||||
addCommand(new MasterBuilderUnban(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,16 +6,14 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.database.DBPool;
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.core.database.ResultSetCallable;
|
||||
import mineplex.core.database.column.ColumnVarChar;
|
||||
import mineplex.database.Tables;
|
||||
import net.md_5.bungee.chat.TranslatableComponentSerializer;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.Insert;
|
||||
import org.jooq.Record2;
|
||||
@ -30,6 +28,7 @@ public class StatsRepository extends RepositoryBase
|
||||
private static String RETRIEVE_STATS = "SELECT id, name FROM stats;";
|
||||
private static String INSERT_STAT = "INSERT INTO stats (name) VALUES (?);";
|
||||
|
||||
|
||||
public StatsRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.getAccount());
|
||||
@ -69,8 +68,14 @@ public class StatsRepository extends RepositoryBase
|
||||
executeUpdate(INSERT_STAT, new ColumnVarChar("name", 100, name));
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void saveStats(NautHashMap<Integer, NautHashMap<Integer, Long>> uploadQueue)
|
||||
{
|
||||
saveStats(uploadQueue, false);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void saveStats(NautHashMap<Integer, NautHashMap<Integer, Long>> uploadQueue, boolean overRideStat)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -83,13 +88,24 @@ public class StatsRepository extends RepositoryBase
|
||||
{
|
||||
for (Integer statId : uploadQueue.get(accountId).keySet())
|
||||
{
|
||||
Update update = context
|
||||
if(overRideStat)
|
||||
{
|
||||
Update update = context
|
||||
.update(Tables.accountStat)
|
||||
.set(Tables.accountStat.value, ULong.valueOf(uploadQueue.get(accountId).get(statId)))
|
||||
.where(Tables.accountStat.accountId.eq(accountId))
|
||||
.and(Tables.accountStat.statId.eq(statId));
|
||||
updates.add(update);
|
||||
}
|
||||
else
|
||||
{
|
||||
Update update = context
|
||||
.update(Tables.accountStat)
|
||||
.set(Tables.accountStat.value, Tables.accountStat.value.plus(uploadQueue.get(accountId).get(statId)))
|
||||
.where(Tables.accountStat.accountId.eq(accountId))
|
||||
.and(Tables.accountStat.statId.eq(statId));
|
||||
|
||||
updates.add(update);
|
||||
updates.add(update);
|
||||
}
|
||||
|
||||
Insert insert = context
|
||||
.insertInto(Tables.accountStat)
|
||||
|
@ -0,0 +1,104 @@
|
||||
package mineplex.core.stats.command;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class MasterBuilderUnban extends CommandBase<StatsManager>
|
||||
{
|
||||
|
||||
public MasterBuilderUnban(StatsManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, "buildunban");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if(args.length != 1)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("MasterBuilder Unban", "/buildunban <Target>"));
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Plugin.getClientManager().getRepository().matchPlayerName(new Callback<List<String>>()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run(List<String> matches)
|
||||
{
|
||||
boolean matchedExact = false;
|
||||
|
||||
for (String match : matches)
|
||||
{
|
||||
if (match.equalsIgnoreCase(args[0]))
|
||||
{
|
||||
matchedExact = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (matchedExact)
|
||||
{
|
||||
for (Iterator<String> matchIterator = matches.iterator(); matchIterator.hasNext();)
|
||||
{
|
||||
if (!matchIterator.next().equalsIgnoreCase(args[0]))
|
||||
{
|
||||
matchIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
UtilPlayer.searchOffline(matches, new Callback<String>()
|
||||
{
|
||||
@Override
|
||||
public void run(String target)
|
||||
{
|
||||
if(target == null)
|
||||
{
|
||||
caller.sendMessage(F.main("MasterBuilder Unban", "Couldn't find " + args[0] + "'s account!"));
|
||||
return;
|
||||
}
|
||||
Plugin.getClientManager().loadClientByName(target, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
CoreClient theClient = Plugin.getClientManager().Get(target);
|
||||
|
||||
if(theClient != null)
|
||||
{
|
||||
Plugin.incrementStat(theClient.getAccountId(), "Global.Build Draw Abuse", 0, true); // True = Resets the stat
|
||||
caller.sendMessage(F.main("MasterBuilder Unban", "The user " + target + " has been unbanned from Master Builders"));
|
||||
}
|
||||
else
|
||||
{
|
||||
caller.sendMessage(F.main("MasterBuilder Unban", "Couldn't find " + target + "'s client!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, caller, args[0], false);
|
||||
}
|
||||
|
||||
}, args[0]);
|
||||
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
caller.sendMessage(F.main("MasterBuilder Unban", "Exception caught! Please contact Morten and explain what happened."));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -8,13 +8,13 @@ import mineplex.core.reward.RewardType;
|
||||
|
||||
public enum TreasureType
|
||||
{
|
||||
OLD(C.cYellow + "Old Treasure", "Old Chest", "Old", RewardType.OldChest, Material.CHEST, TreasureStyle.OLD, RewardPool.Type.NORMAL),
|
||||
OLD(C.cYellow + "Old Treasure", "Old Chest", "Old", RewardType.OldChest, Material.CHEST, TreasureStyle.OLD, RewardPool.Type.NORMAL, true, 1000),
|
||||
|
||||
ANCIENT(C.cGold + "Ancient Treasure", "Ancient Chest", "Ancient", RewardType.AncientChest, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT, RewardPool.Type.NORMAL),
|
||||
ANCIENT(C.cGold + "Ancient Treasure", "Ancient Chest", "Ancient", RewardType.AncientChest, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT, RewardPool.Type.NORMAL, true, 5000),
|
||||
|
||||
MYTHICAL(C.cRed + "Mythical Treasure", "Mythical Chest", "Mythical", RewardType.MythicalChest, Material.ENDER_CHEST, TreasureStyle.MYTHICAL, RewardPool.Type.NORMAL),
|
||||
MYTHICAL(C.cRed + "Mythical Treasure", "Mythical Chest", "Mythical", RewardType.MythicalChest, Material.ENDER_CHEST, TreasureStyle.MYTHICAL, RewardPool.Type.NORMAL, true, 10000),
|
||||
|
||||
CHRISTMAS(C.cDGreen + "Winter Holiday Treasure", "Winter Chest", "Christmas", RewardType.WinterChest, Material.CHEST, TreasureStyle.CHRISTMAS, RewardPool.Type.WINTER_HOLIDAY);
|
||||
CHRISTMAS(C.cDGreen + "Winter Holiday Treasure", "Winter Chest", "Christmas", RewardType.WinterChest, Material.CHEST, TreasureStyle.CHRISTMAS, RewardPool.Type.WINTER_HOLIDAY, false, 15000);
|
||||
|
||||
private final String _name;
|
||||
private final RewardType _rewardType;
|
||||
@ -23,8 +23,10 @@ public enum TreasureType
|
||||
private final String _itemName;
|
||||
private final String _statName;
|
||||
private final RewardPool.Type _rewardPool;
|
||||
private final int _purchasePrice;
|
||||
private final boolean _purchasable;
|
||||
|
||||
TreasureType(String name, String itemName, String statName, RewardType rewardType, Material material, TreasureStyle treasureStyle, RewardPool.Type rewardPool)
|
||||
TreasureType(String name, String itemName, String statName, RewardType rewardType, Material material, TreasureStyle treasureStyle, RewardPool.Type rewardPool, boolean purchasable, int purchasePrice)
|
||||
{
|
||||
_name = name;
|
||||
_itemName = itemName;
|
||||
@ -33,6 +35,8 @@ public enum TreasureType
|
||||
_material = material;
|
||||
_treasureStyle = treasureStyle;
|
||||
_rewardPool = rewardPool;
|
||||
_purchasePrice = purchasePrice;
|
||||
_purchasable = purchasable;
|
||||
}
|
||||
|
||||
public RewardType getRewardType()
|
||||
@ -69,4 +73,14 @@ public enum TreasureType
|
||||
{
|
||||
return _rewardPool;
|
||||
}
|
||||
|
||||
public int getPurchasePrice()
|
||||
{
|
||||
return _purchasePrice;
|
||||
}
|
||||
|
||||
public boolean isPurchasable()
|
||||
{
|
||||
return _purchasable;
|
||||
}
|
||||
}
|
||||
|
@ -122,9 +122,11 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
|
||||
christmasLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
|
||||
else
|
||||
{
|
||||
/*
|
||||
christmasLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "15000 Treasure Shards");
|
||||
christmasLore.add(" ");
|
||||
christmasLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
|
||||
*/
|
||||
}
|
||||
|
||||
List<String> cosmicLore = new ArrayList<String>();
|
||||
@ -143,18 +145,21 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
|
||||
|
||||
addItem(40, shards);
|
||||
|
||||
if (basicCount > 0) addButton(20, basic, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.OLD));
|
||||
else addButton(20, basic, new BuyChestButton(getPlayer(), _inventoryManager, this, "Old Chest", Material.CHEST, 1000));
|
||||
|
||||
if (heroicCount > 0) addButton(22, heroic, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.ANCIENT));
|
||||
else addButton(22, heroic, new BuyChestButton(getPlayer(), _inventoryManager, this, "Ancient Chest", Material.CHEST, 5000));
|
||||
|
||||
if (legendaryCount > 0) addButton(24, legendary, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.MYTHICAL));
|
||||
else addButton(24, legendary, new BuyChestButton(getPlayer(), _inventoryManager, this, "Mythical Chest", Material.ENDER_CHEST, 10000));
|
||||
|
||||
if (christmasCount > 0) addButton(12, christmas, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.CHRISTMAS));
|
||||
else addButton(12, christmas, new BuyChestButton(getPlayer(), _inventoryManager, this, TreasureType.CHRISTMAS.getItemName(), Material.SNOW_BALL, 15000));
|
||||
addChest(20, basic, TreasureType.OLD, basicCount);
|
||||
addChest(22, heroic, TreasureType.ANCIENT, heroicCount);
|
||||
addChest(24, legendary, TreasureType.MYTHICAL, legendaryCount);
|
||||
addChest(12, christmas, TreasureType.CHRISTMAS, christmasCount);
|
||||
|
||||
addItem(14, cosmic);
|
||||
}
|
||||
|
||||
private void addChest(int slot, ItemStack item, TreasureType treasureType, int owned)
|
||||
{
|
||||
if (owned > 0)
|
||||
addButton(slot, item, new OpenTreasureButton(getPlayer(), _treasureLocation, treasureType));
|
||||
else if (treasureType.isPurchasable())
|
||||
addButton(slot, item, new BuyChestButton(getPlayer(), _inventoryManager, this, treasureType.getItemName(), Material.CHEST, treasureType.getPurchasePrice()));
|
||||
else
|
||||
setItem(slot, item);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.ServerData"/>
|
||||
|
@ -0,0 +1,11 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
@ -13,6 +13,8 @@ import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.chat.Chat;
|
||||
import mineplex.core.command.CommandCenter;
|
||||
import mineplex.core.common.events.ServerShutdownEvent;
|
||||
import mineplex.core.delayedtask.DelayedTask;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.explosion.Explosion;
|
||||
import mineplex.core.friend.FriendManager;
|
||||
@ -39,6 +41,7 @@ import mineplex.core.updater.FileUpdater;
|
||||
import mineplex.core.updater.Updater;
|
||||
import mineplex.core.visibility.VisibilityManager;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.ban.ClansBanManager;
|
||||
import mineplex.game.clans.items.GearManager;
|
||||
import mineplex.game.clans.shop.building.BuildingShop;
|
||||
import mineplex.game.clans.shop.farming.FarmingShop;
|
||||
@ -50,7 +53,7 @@ import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
|
||||
public class Clans extends JavaPlugin
|
||||
{
|
||||
public static final String VERSION = "0.17d";
|
||||
public static final String VERSION = "0.18b";
|
||||
private String WEB_CONFIG = "webServer";
|
||||
|
||||
// Modules
|
||||
@ -77,6 +80,8 @@ public class Clans extends JavaPlugin
|
||||
|
||||
ItemStackFactory.Initialize(this, false);
|
||||
|
||||
DelayedTask.Initialize(this);
|
||||
|
||||
Recharge.Initialize(this);
|
||||
VisibilityManager.Initialize(this);
|
||||
// new ProfileCacheManager(this);
|
||||
@ -97,6 +102,8 @@ public class Clans extends JavaPlugin
|
||||
Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName());
|
||||
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
|
||||
|
||||
new ClansBanManager(this, _clientManager, _donationManager);
|
||||
|
||||
Punish punish = new Punish(this, webServerAddress, _clientManager);
|
||||
AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager);
|
||||
AntiHack.Instance.setKick(false);
|
||||
@ -169,5 +176,7 @@ public class Clans extends JavaPlugin
|
||||
// Need to notify WorldEventManager of server shutdown, this seemed like
|
||||
// the only decent way to do it
|
||||
_clansManager.onDisable();
|
||||
|
||||
getServer().getPluginManager().callEvent(new ServerShutdownEvent(this));
|
||||
}
|
||||
}
|
||||
|
@ -20,19 +20,19 @@ import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.game.clans.clans.ClansUtility.ClanRelation;
|
||||
import mineplex.game.clans.core.war.ClanWarData;
|
||||
import net.minecraft.server.v1_8_R3.Material;
|
||||
import mineplex.game.clans.clans.tntGenerator.TntGenerator;
|
||||
import mineplex.game.clans.core.repository.tokens.ClanAllianceToken;
|
||||
import mineplex.game.clans.core.repository.tokens.ClanMemberToken;
|
||||
import mineplex.game.clans.core.repository.tokens.ClanTerritoryToken;
|
||||
import mineplex.game.clans.core.repository.tokens.ClanToken;
|
||||
|
||||
import mineplex.game.clans.clans.tntGenerator.TntGenerator;
|
||||
import mineplex.game.clans.core.repository.tokens.ClanWarToken;
|
||||
import mineplex.game.clans.core.war.ClanWarData;
|
||||
import net.minecraft.server.v1_8_R3.Material;
|
||||
|
||||
public class ClanInfo
|
||||
{
|
||||
@ -375,6 +375,22 @@ public class ClanInfo
|
||||
}
|
||||
}
|
||||
|
||||
public void inform(String top, String bottom, String ignore)
|
||||
{
|
||||
for (UUID cur : getMembers().keySet())
|
||||
{
|
||||
Player player = UtilPlayer.searchExact(cur);
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
if (player.getName().equals(ignore))
|
||||
continue;
|
||||
|
||||
UtilTextMiddle.display(top, bottom, 20, 100, 20, player);
|
||||
}
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
@ -507,6 +523,11 @@ public class ClanInfo
|
||||
|
||||
public int getEnergy()
|
||||
{
|
||||
if (_energy > getEnergyMax())
|
||||
{
|
||||
_energy = getEnergyMax();
|
||||
}
|
||||
|
||||
return _energy;
|
||||
}
|
||||
|
||||
|
@ -38,8 +38,4 @@ public class ClansBlacklist
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void addBlacklist(String blacklist) {
|
||||
BLACKLISTED_NAMES.add(blacklist);
|
||||
}
|
||||
}
|
||||
|
@ -532,8 +532,8 @@ public class ClansDataAccessLayer
|
||||
}
|
||||
|
||||
// Log
|
||||
// _manager.log("Added Claim for [" + name + "] at [" + chunk + "] by ["
|
||||
// + player + "].");
|
||||
_manager.log("Added Claim for [" + name + "] at [" + chunk + "] by ["
|
||||
+ player + "].");
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -595,6 +595,8 @@ public class ClansDataAccessLayer
|
||||
|
||||
// Log
|
||||
if (player != null) _manager.log("Removed Claim for [" + clan.getName() + "] at [" + chunk + "] by [" + player + "].");
|
||||
else
|
||||
_manager.log("Removed Claim for [" + clan.getName() + "] at [" + chunk + "] by [NO ONE?!].");
|
||||
|
||||
// Bed Removal
|
||||
if (clan.getHome() != null && UtilWorld.chunkToStr(clan.getHome().getChunk()).equals(chunk))
|
||||
|
@ -65,7 +65,9 @@ public class ClansDisplay extends MiniPlugin
|
||||
|
||||
boolean safe = Clans.getClanUtility().isSafe(player);
|
||||
|
||||
UtilServer.getServer().getPluginManager().callEvent(new PlayerEnterTerritoryEvent(player, client.getOwner(), owner, owner.equals("Wilderness") ? false : Clans.getClanUtility().getClaim(player.getLocation()).isSafe(player.getLocation())));
|
||||
PlayerEnterTerritoryEvent event = new PlayerEnterTerritoryEvent(player, client.getOwner(), owner, owner.equals("Wilderness") ? false : Clans.getClanUtility().getClaim(player.getLocation()).isSafe(player.getLocation()), true);
|
||||
|
||||
UtilServer.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!client.isMapOn())
|
||||
{
|
||||
@ -87,13 +89,13 @@ public class ClansDisplay extends MiniPlugin
|
||||
|
||||
if (showChange)
|
||||
{
|
||||
displayOwner(player);
|
||||
// Event
|
||||
if (event.willSendMessage()) displayOwner(player);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
displayOwner(player);
|
||||
if (event.willSendMessage()) displayOwner(player);
|
||||
|
||||
displayMap(player);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
package mineplex.game.clans.clans;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
@ -28,9 +28,11 @@ import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
@ -72,6 +74,7 @@ import mineplex.game.clans.clans.commands.ClansCommand;
|
||||
import mineplex.game.clans.clans.commands.ClansLoginManager;
|
||||
import mineplex.game.clans.clans.commands.KillCommand;
|
||||
import mineplex.game.clans.clans.commands.MapCommand;
|
||||
import mineplex.game.clans.clans.commands.Meow;
|
||||
import mineplex.game.clans.clans.commands.RegionsCommand;
|
||||
import mineplex.game.clans.clans.data.PlayerClan;
|
||||
import mineplex.game.clans.clans.event.ClansPlayerDeathEvent;
|
||||
@ -79,6 +82,7 @@ import mineplex.game.clans.clans.gui.ClanShop;
|
||||
import mineplex.game.clans.clans.loot.LootManager;
|
||||
import mineplex.game.clans.clans.map.ItemMapManager;
|
||||
import mineplex.game.clans.clans.observer.ObserverManager;
|
||||
import mineplex.game.clans.clans.outpost.OutpostManager;
|
||||
import mineplex.game.clans.clans.playtime.Playtime;
|
||||
import mineplex.game.clans.clans.potato.PotatoManager;
|
||||
import mineplex.game.clans.clans.pvptimer.PvpTimer;
|
||||
@ -203,6 +207,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
{
|
||||
super("Clans Manager", plugin);
|
||||
|
||||
if (serverName.equals("GarboClans-1"))
|
||||
{
|
||||
addCommand(new Meow(new OutpostManager(this)));
|
||||
}
|
||||
|
||||
_instance = this;
|
||||
|
||||
_serverName = serverName;
|
||||
@ -366,17 +375,26 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
hologram.start();
|
||||
}
|
||||
|
||||
// Disables beds from being crafted
|
||||
Iterator<Recipe> it = _plugin.getServer().recipeIterator();
|
||||
Recipe recipe;
|
||||
while (it.hasNext())
|
||||
{
|
||||
recipe = it.next();
|
||||
if (recipe != null && recipe.getResult().getType() == Material.BED)
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
// Iterator<Recipe> it = _plugin.getServer().recipeIterator();
|
||||
// Recipe recipe;
|
||||
// while (it.hasNext())
|
||||
// {
|
||||
// recipe = it.next();
|
||||
// if (recipe != null)
|
||||
// {
|
||||
// if (recipe.getResult().getType() == Material.SMOOTH_BRICK)
|
||||
// {
|
||||
// it.remove();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// final ShapedRecipe brrecipe = new ShapedRecipe(new ItemStack(Material.SMOOTH_BRICK, 1));
|
||||
// brrecipe.shape("XX", "XX", "");
|
||||
// brrecipe.setIngredient('X', Material.STONE);
|
||||
// UtilServer.getServer().addRecipe(brrecipe);
|
||||
//
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "Replay|Restrict");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -578,12 +596,33 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
clanInfo.playerOnline(player);
|
||||
}
|
||||
|
||||
if (_clientManager.hasRank(player, Rank.DEVELOPER) || player.getName().equals("NewGarbo"))
|
||||
if (_clientManager.hasRank(player, Rank.DEVELOPER) || player.getUniqueId().toString().equals("d8646a35-33a8-43c6-9e7c-2e871a6b86c9"))
|
||||
{
|
||||
player.setOp(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void disallowReplayMod(PlayerJoinEvent event)
|
||||
{
|
||||
// happens 20 ticks later because player channels don't
|
||||
// seem to work immediately after joining.
|
||||
runSyncLater(() -> {
|
||||
ByteArrayDataOutput bado = ByteStreams.newDataOutput();
|
||||
|
||||
bado.writeUTF("no_xray");
|
||||
bado.writeBoolean(true);
|
||||
|
||||
bado.writeUTF("no_noclip");
|
||||
bado.writeBoolean(true);
|
||||
|
||||
bado.writeUTF("only_recording_player");
|
||||
bado.writeBoolean(true);
|
||||
|
||||
event.getPlayer().sendPluginMessage(_plugin, "Replay|Restrict", bado.toByteArray());
|
||||
}, 20L);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void denyBow(EntityShootBowEvent event)
|
||||
{
|
||||
@ -610,14 +649,74 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handlePlayerChat(AsyncPlayerChatEvent event)
|
||||
private void handleClanChat(Player player, String message, ClanInfo clan, String rank)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
for (Player cur : clan.getOnlinePlayers())
|
||||
{
|
||||
message = _chat.getFilteredMessage(player, message);
|
||||
|
||||
UtilPlayer.message(cur, String.format(rank + C.cAqua + "%s " + C.cDAqua + "%s", player.getName(), message));
|
||||
}
|
||||
}
|
||||
|
||||
private void handleAllyChat(Player player, String message, ClanInfo clan, String rank)
|
||||
{
|
||||
List<Player> recipients = new ArrayList<>();
|
||||
|
||||
clan.getOnlinePlayers().forEach(recipients::add);
|
||||
|
||||
for (String allyName : clan.getAllyMap().keySet())
|
||||
{
|
||||
ClanInfo ally = _clanUtility.getClanByClanName(allyName);
|
||||
if (ally == null) continue;
|
||||
|
||||
ally.getOnlinePlayers().forEach(recipients::add);
|
||||
}
|
||||
|
||||
final String filtered = _chat.getFilteredMessage(player, message);
|
||||
|
||||
recipients.forEach(p -> UtilPlayer.message(p, String.format(rank + C.cDGreen + clan.getName() + " " + C.cDGreen + "%s " + C.cGreen + "%s", player.getName(), filtered)));
|
||||
|
||||
recipients.clear();
|
||||
}
|
||||
|
||||
private void handleRegularChat(AsyncPlayerChatEvent event, ClanInfo clan, String rank)
|
||||
{
|
||||
if (clan == null)
|
||||
{
|
||||
UtilServer.broadcast(String.format(rank + C.cYellow + "%s " + C.cWhite + "%s", event.getPlayer().getName(), event.getMessage()));
|
||||
return;
|
||||
}
|
||||
|
||||
List<Player> recipients = new ArrayList<>();
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
ClanInfo otherClan = _clanUtility.getClanByPlayer(other);
|
||||
|
||||
if (otherClan == null)
|
||||
{
|
||||
recipients.add(other);
|
||||
}
|
||||
else
|
||||
{
|
||||
String message = _chat.getFilteredMessage(event.getPlayer(), event.getMessage());
|
||||
ClanRelation rel = _clanUtility.rel(clan, otherClan);
|
||||
|
||||
other.sendMessage(rank + rel.getColor(true) + clan.getName() + " " + rel.getColor(false) + event.getPlayer().getName() + " " + C.cWhite + message);
|
||||
}
|
||||
}
|
||||
|
||||
recipients.forEach(p -> p.sendMessage(String.format(rank + C.cGold + clan.getName() + " " + C.cYellow + "%s " + C.cWhite + "%s", event.getPlayer().getName(), event.getMessage())));
|
||||
|
||||
recipients.clear();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void handlePlayerChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
ClientClan client = Get(event.getPlayer());
|
||||
|
||||
if (client == null)
|
||||
@ -634,91 +733,21 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
|
||||
if (client.isClanChat() && clan != null)
|
||||
{
|
||||
event.setFormat(rank+ C.cAqua + "%1$s " + C.cDAqua + "%2$s");
|
||||
event.getRecipients().clear();
|
||||
|
||||
for (ClansPlayer cur : clan.getMembers().values())
|
||||
{
|
||||
Player player = UtilPlayer.searchExact(cur.getUuid());
|
||||
|
||||
if (player == null) continue;
|
||||
|
||||
event.getRecipients().add(player);
|
||||
}
|
||||
handleClanChat(event.getPlayer(), event.getMessage(), clan, rank);
|
||||
}
|
||||
else if (client.isAllyChat() && clan != null)
|
||||
{
|
||||
event.setFormat(rank+ C.cDGreen + clan.getName() + " " + C.cDGreen + "%1$s " + C.cGreen + "%2$s");
|
||||
event.getRecipients().clear();
|
||||
|
||||
for (ClansPlayer cur : clan.getMembers().values())
|
||||
{
|
||||
Player player = UtilPlayer.searchExact(cur.getUuid());
|
||||
|
||||
if (player == null) continue;
|
||||
|
||||
event.getRecipients().add(player);
|
||||
}
|
||||
|
||||
for (String allyName : clan.getAllyMap().keySet())
|
||||
{
|
||||
ClanInfo ally = _clanUtility.getClanByClanName(allyName);
|
||||
if (ally == null) continue;
|
||||
|
||||
for (ClansPlayer cur : ally.getMembers().values())
|
||||
{
|
||||
Player player = UtilPlayer.searchExact(cur.getUuid());
|
||||
|
||||
if (player == null) continue;
|
||||
|
||||
event.getRecipients().add(player);
|
||||
}
|
||||
}
|
||||
handleAllyChat(event.getPlayer(), event.getMessage(), clan, rank);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (clan == null)
|
||||
{
|
||||
event.setFormat(rank + C.cYellow + "%1$s " + C.cWhite + "%2$s");
|
||||
System.out.println(_clientManager.Get(event.getPlayer()).GetRank().name() + " " + event.getPlayer().getName() + " " + event.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
event.getRecipients().clear();
|
||||
event.setFormat(rank + C.cGold + clan.getName() + " " + C.cYellow + "%1$s " + C.cWhite + "%2$s");
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
ClanInfo otherClan = _clanUtility.getClanByPlayer(other);
|
||||
|
||||
if (otherClan == null)
|
||||
{
|
||||
event.getRecipients().add(other);
|
||||
}
|
||||
else
|
||||
{
|
||||
String message = event.getMessage();
|
||||
message = _chat.getFilteredMessage(event.getPlayer(), message);
|
||||
ClanRelation rel = _clanUtility.rel(clan, otherClan);
|
||||
String formatted = rank + rel.getColor(true) + clan.getName() + " " + rel.getColor(false) + event.getPlayer().getName() + " " + C.cWhite + message;
|
||||
other.sendMessage(formatted);
|
||||
}
|
||||
}
|
||||
handleRegularChat(event, clan, rank);
|
||||
}
|
||||
|
||||
System.out.println((clan == null ? "" : clan.getName()) + " " + _clientManager.Get(event.getPlayer()).GetRank().name() + " " + event.getPlayer().getName() + " " + event.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void command(PlayerCommandPreprocessEvent event){
|
||||
if (event.getMessage().startsWith("/blacklist ")){
|
||||
String blacklist = event.getMessage().split(" ")[1];
|
||||
|
||||
ClansBlacklist.addBlacklist(blacklist);
|
||||
}
|
||||
}
|
||||
|
||||
public void messageClan(ClanInfo clan, String message)
|
||||
{
|
||||
for (Player player : clan.getOnlinePlayers())
|
||||
@ -747,22 +776,22 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
|
||||
public void chatClan(ClanInfo clan, Player caller, String message)
|
||||
{
|
||||
messageClan(clan, C.cAqua + caller.getName() + " " + C.cDAqua + message);
|
||||
String rank = _clientManager.Get(caller).GetRank().getTag(true, true) + " ";
|
||||
|
||||
if (!_clientManager.Get(caller).GetRank().has(Rank.TWITCH))
|
||||
rank = "";
|
||||
|
||||
handleClanChat(caller, message, clan, rank);
|
||||
}
|
||||
|
||||
public void chatAlly(ClanInfo clan, Player caller, String message)
|
||||
{
|
||||
String sendMessage = C.cDGreen + clan.getName() + " " + C.cDGreen + caller.getName() + " " + C.cGreen + message;
|
||||
String rank = _clientManager.Get(caller).GetRank().getTag(true, true) + " ";
|
||||
|
||||
messageClan(clan, sendMessage);
|
||||
if (!_clientManager.Get(caller).GetRank().has(Rank.TWITCH))
|
||||
rank = "";
|
||||
|
||||
for (String allyName : clan.getAllyMap().keySet())
|
||||
{
|
||||
ClanInfo ally = _clanUtility.getClanByClanName(allyName);
|
||||
if (ally == null) continue;
|
||||
|
||||
messageClan(ally, sendMessage);
|
||||
}
|
||||
handleAllyChat(caller, message, clan, rank);
|
||||
}
|
||||
|
||||
public int getNameMin()
|
||||
|
@ -0,0 +1,18 @@
|
||||
package mineplex.game.clans.clans;
|
||||
|
||||
public enum ClansPlayerTasks
|
||||
{
|
||||
FIRST_SESSION("Clans.FirstSession");
|
||||
|
||||
private String _id;
|
||||
|
||||
ClansPlayerTasks(String id)
|
||||
{
|
||||
_id = id;
|
||||
}
|
||||
|
||||
public String id()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package mineplex.game.clans.clans.ban;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
|
||||
public class ClansBan
|
||||
{
|
||||
private int _id;
|
||||
private int _accountId;
|
||||
private String _reason;
|
||||
private Timestamp _banTime;
|
||||
private Timestamp _unbanTime;
|
||||
private boolean _permanent;
|
||||
private boolean _removed;
|
||||
|
||||
public ClansBan(int id, int accountId, String reason, Timestamp banTime, Timestamp unbanTime, boolean permanent, boolean removed)
|
||||
{
|
||||
_id = id;
|
||||
_accountId = accountId;
|
||||
_reason = reason;
|
||||
_banTime = banTime;
|
||||
_unbanTime = unbanTime;
|
||||
_permanent = permanent;
|
||||
_removed = removed;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
public int getAccountId()
|
||||
{
|
||||
return _accountId;
|
||||
}
|
||||
|
||||
public String getReason()
|
||||
{
|
||||
return _reason;
|
||||
}
|
||||
|
||||
public Timestamp getBanTime()
|
||||
{
|
||||
return _banTime;
|
||||
}
|
||||
|
||||
public long getLength()
|
||||
{
|
||||
return _unbanTime.getTime() - _banTime.getTime();
|
||||
}
|
||||
|
||||
public long getTimeLeft()
|
||||
{
|
||||
return Math.max(0, _unbanTime.getTime() - System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public Timestamp getUnbanTime()
|
||||
{
|
||||
return _unbanTime;
|
||||
}
|
||||
|
||||
public boolean isPermanent()
|
||||
{
|
||||
return _permanent;
|
||||
}
|
||||
|
||||
public String getBanTimeFormatted(boolean wording)
|
||||
{
|
||||
long time = getTimeLeft();
|
||||
|
||||
return time == -1 ? F.time("permanently") : (wording ? "for " : "") + F.time(UtilTime.MakeStr(time));
|
||||
}
|
||||
|
||||
public boolean isRemoved()
|
||||
{
|
||||
return _removed;
|
||||
}
|
||||
|
||||
public boolean isActive()
|
||||
{
|
||||
return (isPermanent() || getTimeLeft() > 0) && !isRemoved();
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package mineplex.game.clans.clans.ban;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
|
||||
public class ClansBanClient
|
||||
{
|
||||
public int AccountId;
|
||||
public List<ClansBan> Bans;
|
||||
|
||||
public ClansBanClient(int accountId, List<ClansBan> bans)
|
||||
{
|
||||
AccountId = accountId;
|
||||
Bans = bans;
|
||||
}
|
||||
|
||||
public boolean isBanned()
|
||||
{
|
||||
for (ClansBan ban : Bans)
|
||||
{
|
||||
if (ban.isActive())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public long getBanTime()
|
||||
{
|
||||
long time = 0;
|
||||
|
||||
for (ClansBan ban : Bans)
|
||||
{
|
||||
if (!ban.isActive())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ban.isPermanent())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
time += ban.getTimeLeft();
|
||||
}
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
public String getBanTimeFormatted()
|
||||
{
|
||||
long time = getBanTime();
|
||||
|
||||
return time == -1 ? F.time("permanently") : "for " + F.time(UtilTime.MakeStr(time));
|
||||
}
|
||||
|
||||
public ClansBan getLongestBan()
|
||||
{
|
||||
ClansBan longest = null;
|
||||
|
||||
for (ClansBan ban : Bans)
|
||||
{
|
||||
if (!ban.isActive())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (longest == null)
|
||||
{
|
||||
longest = ban;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ban.getTimeLeft() > longest.getTimeLeft())
|
||||
{
|
||||
longest = ban;
|
||||
}
|
||||
}
|
||||
|
||||
return longest;
|
||||
}
|
||||
}
|
@ -0,0 +1,210 @@
|
||||
package mineplex.game.clans.clans.ban;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.game.clans.clans.ban.commands.ClansBanCommand;
|
||||
import mineplex.game.clans.clans.ban.commands.ClansBanListCommand;
|
||||
import mineplex.game.clans.clans.ban.ui.ClansBanListShop;
|
||||
import mineplex.game.clans.clans.ban.ui.ClansBanShop;
|
||||
|
||||
public class ClansBanManager extends MiniPlugin
|
||||
{
|
||||
private CoreClientManager _clientManager;
|
||||
private ClansBanRepository _repository;
|
||||
private Map<String, ClansBanClient> _clients;
|
||||
private Map<String, String> _cache;
|
||||
private ClansBanShop _shop;
|
||||
private ClansBanListShop _shop2;
|
||||
|
||||
public ClansBanManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
|
||||
{
|
||||
super("Blacklist", plugin);
|
||||
|
||||
_clientManager = clientManager;
|
||||
|
||||
_repository = new ClansBanRepository(plugin, this);
|
||||
|
||||
_clients = new HashMap<>();
|
||||
_cache = new HashMap<>();
|
||||
|
||||
_shop = new ClansBanShop(this, clientManager, donationManager);
|
||||
_shop2 = new ClansBanListShop(this, clientManager, donationManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCommands()
|
||||
{
|
||||
addCommand(new ClansBanCommand(this));
|
||||
addCommand(new ClansBanListCommand(this));
|
||||
}
|
||||
|
||||
public void ban(ClansBanClient client, String name, long time, String reason, Callback<ClansBanClient> callback)
|
||||
{
|
||||
_repository.ban(client.AccountId, time, reason, time == -1);
|
||||
|
||||
LoadClient(name, callback);
|
||||
}
|
||||
|
||||
public CoreClientManager getClientManager()
|
||||
{
|
||||
return _clientManager;
|
||||
}
|
||||
|
||||
public ClansBanRepository GetRepository()
|
||||
{
|
||||
return _repository;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
LoadClient(event.getPlayer().getName(), client -> {
|
||||
if (client.isBanned())
|
||||
{
|
||||
String time = UtilTime.convertString(client.getLongestBan().getTimeLeft(), 0, TimeUnit.FIT);
|
||||
|
||||
if (client.getLongestBan().isPermanent())
|
||||
time = "Permanent";
|
||||
|
||||
String reason = C.cRedB + "You are banned from Clans for " + time +
|
||||
"\n" + C.cWhite + client.getLongestBan().getReason()
|
||||
;
|
||||
|
||||
event.getPlayer().kickPlayer(reason);
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilServer.broadcast(F.sys("Join", event.getPlayer().getName()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
if (Get(event.getPlayer().getName()) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Get(event.getPlayer().getName()).isBanned())
|
||||
{
|
||||
event.setQuitMessage(null);
|
||||
}
|
||||
|
||||
UnloadClient(Get(event.getPlayer().getName()));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerKicked(PlayerKickEvent event)
|
||||
{
|
||||
if (Get(event.getPlayer().getName()) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Get(event.getPlayer().getName()).isBanned())
|
||||
{
|
||||
event.setLeaveMessage(null);
|
||||
}
|
||||
|
||||
UnloadClient(Get(event.getPlayer().getName()));
|
||||
}
|
||||
|
||||
public void UnloadClient(ClansBanClient client)
|
||||
{
|
||||
String name = "";
|
||||
|
||||
for (Entry<String, ClansBanClient> entry : _clients.entrySet())
|
||||
{
|
||||
if (entry.getValue().equals(client))
|
||||
{
|
||||
name = entry.getKey();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_clients.remove(name);
|
||||
}
|
||||
|
||||
public void LoadClient(final String name, Callback<ClansBanClient> callback)
|
||||
{
|
||||
GetRepository().loadBans(name, client -> {
|
||||
_clients.put(name, client);
|
||||
System.out.println("> CLIENTS: " + _clients);
|
||||
if (callback != null) callback.run(client);
|
||||
});
|
||||
}
|
||||
|
||||
public ClansBanClient Get(String name)
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
return _clients.get(name.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
public ClansBanShop getShop()
|
||||
{
|
||||
return _shop;
|
||||
}
|
||||
|
||||
public ClansBanListShop getShop2()
|
||||
{
|
||||
return _shop2;
|
||||
}
|
||||
|
||||
public void cache(Player player, String playerName)
|
||||
{
|
||||
_cache.put(player.getName(), playerName);
|
||||
}
|
||||
|
||||
public String getCachedName(Player player)
|
||||
{
|
||||
return _cache.get(player.getName());
|
||||
}
|
||||
|
||||
public void clearCachedName(String name)
|
||||
{
|
||||
_cache.remove(name);
|
||||
}
|
||||
|
||||
public void unban(ClansBanClient target, ClansBan ban, String name, Callback<ClansBanClient> callback)
|
||||
{
|
||||
if (target.AccountId != ban.getAccountId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_repository.removeBan(ban);
|
||||
|
||||
LoadClient(name, callback);
|
||||
}
|
||||
|
||||
public void listRecordedNames(Callback<List<ClansBanClient>> callback)
|
||||
{
|
||||
GetRepository().loadAll(callback);
|
||||
}
|
||||
}
|
@ -0,0 +1,163 @@
|
||||
package mineplex.game.clans.clans.ban;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NonFinalInteger;
|
||||
import mineplex.core.database.DBPool;
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.core.database.ResultSetCallable;
|
||||
import mineplex.core.database.column.ColumnBoolean;
|
||||
import mineplex.core.database.column.ColumnInt;
|
||||
import mineplex.core.database.column.ColumnTimestamp;
|
||||
import mineplex.core.database.column.ColumnVarChar;
|
||||
|
||||
public class ClansBanRepository extends RepositoryBase
|
||||
{
|
||||
private ClansBanManager _manager;
|
||||
|
||||
private static final String GET_LONGEST_BAN = "SELECT * FROM clanBans WHERE (NOW() < unbanTime OR permanent=1) AND accountId = ? ORDER BY permanent DESC, unbanTime DESC LIMIT 1;";
|
||||
private static final String BAN_PLAYER = "INSERT INTO clanBans (accountId, reason, banTime, unbanTime, permanent, removed) VALUES (?, ?, ?, ?, ?, ?);";
|
||||
private static final String REMOVE_BAN = "UPDATE clanBans SET removed = 1 WHERE id = ?;";
|
||||
private static final String GET_ALL_BANS = "SELECT * FROM clanBans WHERE accountId = ?;";
|
||||
private static final String GET_ALL_ACCOUNTS = "SELECT DISTINCT accountId FROM clanBans;";
|
||||
|
||||
public ClansBanRepository(JavaPlugin plugin, ClansBanManager manager)
|
||||
{
|
||||
super(plugin, DBPool.getAccount());
|
||||
|
||||
_manager = manager;
|
||||
}
|
||||
|
||||
public void ban(int accountId, long time, String reason, boolean permanent)
|
||||
{
|
||||
executeInsert(BAN_PLAYER, null,
|
||||
new ColumnInt("accountId", accountId),
|
||||
new ColumnVarChar("reason", 128, reason),
|
||||
new ColumnTimestamp("banTime", new Timestamp(System.currentTimeMillis())),
|
||||
new ColumnTimestamp("unbanTime", new Timestamp(System.currentTimeMillis() + time)),
|
||||
new ColumnBoolean("permanent", permanent),
|
||||
new ColumnBoolean("removed", false)
|
||||
);
|
||||
}
|
||||
|
||||
public void loadBans(final String name, final Callback<ClansBanClient> callback)
|
||||
{
|
||||
System.out.println(">> Attempting to load Clans Bans for \"" + name + "\"");
|
||||
loadClientByName(name, client -> {
|
||||
System.out.println("> Successfully loaded CoreClient");
|
||||
|
||||
executeQuery(GET_ALL_BANS, resultSet -> {
|
||||
System.out.println("> Successfully executed query, result set object: " + resultSet);
|
||||
|
||||
final List<ClansBan> list = new ArrayList<ClansBan>();
|
||||
|
||||
while (resultSet.next())
|
||||
{
|
||||
int id = resultSet.getInt(1);
|
||||
int accountId = resultSet.getInt(2);
|
||||
String reason = resultSet.getString(3);
|
||||
Timestamp banTime = resultSet.getTimestamp(4);
|
||||
Timestamp unbanTime = resultSet.getTimestamp(5);
|
||||
boolean permanent = resultSet.getBoolean(6);
|
||||
boolean removed = resultSet.getBoolean(7);
|
||||
|
||||
list.add(new ClansBan(id, accountId, reason, banTime, unbanTime, permanent, removed));
|
||||
}
|
||||
|
||||
callback.run(new ClansBanClient(client.getAccountId(), list));
|
||||
|
||||
System.out.println("> Successfully handled result");
|
||||
System.out.println(">> FINISH");
|
||||
}, new ColumnInt("accountId", client.getAccountId()));
|
||||
});
|
||||
}
|
||||
|
||||
public void getLongestBan(final String name, final Callback<ClansBan> callback)
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
loadClientByName(name, client -> {
|
||||
executeQuery(GET_LONGEST_BAN, resultSet -> {
|
||||
while (resultSet.next())
|
||||
{
|
||||
int id = resultSet.getInt(1);
|
||||
int accountId = resultSet.getInt(2);
|
||||
String reason = resultSet.getString(3);
|
||||
Timestamp banTime = resultSet.getTimestamp(4);
|
||||
Timestamp unbanTime = resultSet.getTimestamp(5);
|
||||
boolean permanent = resultSet.getBoolean(6);
|
||||
boolean removed = resultSet.getBoolean(7);
|
||||
|
||||
callback.run(new ClansBan(id, accountId, reason, banTime, unbanTime, permanent, removed));
|
||||
}
|
||||
}, new ColumnInt("accountId", client.getAccountId()));
|
||||
});
|
||||
}
|
||||
|
||||
public void loadClientByName(String name, Callback<CoreClient> client)
|
||||
{
|
||||
if (_manager.getClientManager().Contains(name))
|
||||
{
|
||||
client.run(_manager.getClientManager().Get(name));
|
||||
}
|
||||
else
|
||||
{
|
||||
_manager.getClientManager().loadClientByName(name, () -> client.run(_manager.getClientManager().Get(name)));
|
||||
}
|
||||
}
|
||||
|
||||
public void loadAll(Callback<List<ClansBanClient>> callback)
|
||||
{
|
||||
_manager.runAsync(() -> {
|
||||
executeQuery(GET_ALL_ACCOUNTS, new ResultSetCallable()
|
||||
{
|
||||
@Override
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
final List<ClansBanClient> clients = new ArrayList<>();
|
||||
final NonFinalInteger resultsProcessed = new NonFinalInteger();
|
||||
int resultsFound = 0;
|
||||
|
||||
while (resultSet.next())
|
||||
{
|
||||
resultsFound++;
|
||||
|
||||
int accountId = resultSet.getInt(0);
|
||||
|
||||
// loadBans(_manager.getClientManager().)
|
||||
|
||||
}
|
||||
|
||||
System.out.println("Found: " + resultsFound + ", Processed: " + resultsProcessed);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update()
|
||||
{
|
||||
}
|
||||
|
||||
public void removeBan(ClansBan ban)
|
||||
{
|
||||
executeUpdate(REMOVE_BAN, new ColumnInt("id", ban.getId()));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package mineplex.game.clans.clans.ban.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.game.clans.clans.ban.ClansBanManager;
|
||||
|
||||
public class ClansBanCommand extends CommandBase<ClansBanManager>
|
||||
{
|
||||
public ClansBanCommand(ClansBanManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, "cbans", "cb");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length < 1)
|
||||
{
|
||||
UtilPlayer.message(caller, C.cGold + "/cb <username> <timeInDays(number)/p(ermanent)> <description> - Bans the specified player for the specified amount of time");
|
||||
UtilPlayer.message(caller, C.cGold + "/cb <username> - Displays the \"Clans Punish\" UI, and will display all of the player's past bans (including current ones)");
|
||||
}
|
||||
else if (args.length == 1)
|
||||
{
|
||||
final String playerName = args[0];
|
||||
|
||||
Plugin.cache(caller, playerName);
|
||||
Plugin.getShop().attemptShopOpen(caller);
|
||||
}
|
||||
else if (args.length > 2)
|
||||
{
|
||||
final String playerName = args[0];
|
||||
final float time;
|
||||
final boolean permanent = args[1].startsWith("p");
|
||||
|
||||
if (!permanent)
|
||||
{
|
||||
try
|
||||
{
|
||||
time = Float.parseFloat(args[1]);
|
||||
}
|
||||
catch(NumberFormatException e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You must provide a valid floating point number for the time (in days). e.g. " + F.elem("1.5") + ", " + F.elem("3.2") + "."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Required for compilation reasons
|
||||
time = 0;
|
||||
}
|
||||
|
||||
String reason = args[2];
|
||||
|
||||
for (int i = 3; i < args.length; i++)
|
||||
{
|
||||
reason += " " + args[i];
|
||||
}
|
||||
|
||||
final String finalReason = reason;
|
||||
|
||||
//Match exact online first
|
||||
Player target = UtilPlayer.searchExact(playerName);
|
||||
if (target != null)
|
||||
{
|
||||
Plugin.LoadClient(playerName, client -> {
|
||||
Plugin.ban(client, target.getName(), permanent ? -1 : (long) (time * 24.f * 60.f * 60.f * 1000.f), finalReason, c -> {
|
||||
UtilPlayer.message(caller, F.main("Clans", F.elem(playerName) + " is now banned " + F.time(c.getBanTimeFormatted()) + "."));
|
||||
Bukkit.broadcastMessage(F.main("Clans", F.elem(playerName) + " is now banned " + F.time(c.getBanTimeFormatted()) + "."));
|
||||
Plugin.runSync(() -> target.kickPlayer(C.cRedB + "You have been banned from Clans " + c.getBanTimeFormatted() + "."));
|
||||
});
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Plugin.LoadClient(playerName, client -> {
|
||||
Plugin.ban(client, playerName, permanent ? -1 : (long) (time * 24.f * 60.f * 60.f * 1000.f), finalReason, c -> {
|
||||
UtilPlayer.message(caller, F.main("Clans", F.elem(playerName) + " is now banned " + c.getBanTimeFormatted() + "."));
|
||||
Bukkit.broadcastMessage(F.main("Clans", F.elem(playerName) + " is now banned " + F.time(c.getBanTimeFormatted()) + "."));
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, C.cGold + "/cp <username> <timeInDays(number)/p(ermanent)> <description> - Bans the specified player for the specified amount of time");
|
||||
UtilPlayer.message(caller, C.cGold + "/cp <username> - Displays the \"Clans Punish\" UI, and will display all of the player's past bans (including current ones)");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package mineplex.game.clans.clans.ban.commands;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.game.clans.clans.ban.ClansBanManager;
|
||||
|
||||
public class ClansBanListCommand extends CommandBase<ClansBanManager>
|
||||
{
|
||||
public ClansBanListCommand(ClansBanManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, "listbans");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
Plugin.getShop2().attemptShopOpen(caller);
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package mineplex.game.clans.clans.ban.ui;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.game.clans.clans.ban.ClansBanClient;
|
||||
import mineplex.game.clans.clans.ban.ClansBanManager;
|
||||
|
||||
public class ClansBanListPage extends ShopPageBase<ClansBanManager, ClansBanListShop>
|
||||
{
|
||||
public ClansBanListPage(final ClansBanManager banManager, final ClansBanListShop shop, final CoreClientManager clientManager, final DonationManager donationManager, final String name, final Player player)
|
||||
{
|
||||
super(banManager, shop, clientManager, donationManager, name, player);
|
||||
|
||||
buildPage();
|
||||
}
|
||||
|
||||
protected void buildPage()
|
||||
{
|
||||
getPlugin().listRecordedNames(clients -> {
|
||||
for (ClansBanClient client : clients)
|
||||
{
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package mineplex.game.clans.clans.ban.ui;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.ShopBase;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.game.clans.clans.ban.ClansBanManager;
|
||||
|
||||
public class ClansBanListShop extends ShopBase<ClansBanManager>
|
||||
{
|
||||
public ClansBanListShop(final ClansBanManager plugin, final CoreClientManager clientManager, final DonationManager donationManager)
|
||||
{
|
||||
super(plugin, clientManager, donationManager, "Clans Punish");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ShopPageBase<ClansBanManager, ? extends ShopBase<ClansBanManager>> buildPagesFor(final Player player)
|
||||
{
|
||||
return new ClansBanListPage(getPlugin(), this, getClientManager(), getDonationManager(), "Clans Punish", player);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package mineplex.game.clans.clans.ban.ui;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.game.clans.clans.ban.ClansBan;
|
||||
import mineplex.game.clans.clans.ban.ClansBanManager;
|
||||
|
||||
public class ClansBanPage extends ShopPageBase<ClansBanManager, ClansBanShop>
|
||||
{
|
||||
public ClansBanPage(final ClansBanManager banManager, final ClansBanShop shop, final CoreClientManager clientManager, final DonationManager donationManager, final String name, final Player player)
|
||||
{
|
||||
super(banManager, shop, clientManager, donationManager, name, player);
|
||||
|
||||
buildPage();
|
||||
}
|
||||
|
||||
protected void buildPage()
|
||||
{
|
||||
String name = getPlugin().getCachedName(getPlayer());
|
||||
getPlugin().LoadClient(name, client -> {
|
||||
int slot = 0;
|
||||
|
||||
for (ClansBan ban : client.Bans)
|
||||
{
|
||||
ItemStack item =
|
||||
new ItemBuilder(ban.isActive() ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK)
|
||||
.setTitle(ban.isActive() ? C.cGreenB + "Active" : C.cRedB + "Inactive")
|
||||
|
||||
.addLore(" ")
|
||||
.addLore("Date banned: " + C.cYellow + UtilTime.date(ban.getBanTime().getTime()))
|
||||
.addLore("Time left: " + C.cYellow + (ban.isActive() ? ban.getBanTimeFormatted(false) : "None"))
|
||||
.addLore("Permanent: " + C.cYellow + (ban.isPermanent() ? "Yes" : "No"))
|
||||
.addLore(C.cGray + "Reason: " + C.cYellow + ban.getReason(), 16)
|
||||
.addLore("Is Disabled: " + C.cYellow + (ban.isRemoved() ? "Yes" : "No"))
|
||||
.addLore(!ban.isActive() ? null : C.cDAqua + "Left-Click to disable ban")
|
||||
|
||||
.build();
|
||||
|
||||
if (ban.isActive())
|
||||
{
|
||||
UtilInv.addDullEnchantment(item);
|
||||
}
|
||||
|
||||
addButton(slot++, item, (player, click) -> {
|
||||
if (ban.isActive())
|
||||
{
|
||||
getPlugin().unban(client, ban, name, c -> refresh());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package mineplex.game.clans.clans.ban.ui;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.ShopBase;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.game.clans.clans.ban.ClansBanManager;
|
||||
|
||||
public class ClansBanShop extends ShopBase<ClansBanManager>
|
||||
{
|
||||
public ClansBanShop(final ClansBanManager plugin, final CoreClientManager clientManager, final DonationManager donationManager)
|
||||
{
|
||||
super(plugin, clientManager, donationManager, "Clans Punish");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ShopPageBase<ClansBanManager, ? extends ShopBase<ClansBanManager>> buildPagesFor(final Player player)
|
||||
{
|
||||
return new ClansBanPage(getPlugin(), this, getClientManager(), getDonationManager(), "Clans Punish", player);
|
||||
}
|
||||
|
||||
}
|
@ -15,9 +15,12 @@ import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilInput;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.delayedtask.DelayedTask;
|
||||
import mineplex.core.delayedtask.DelayedTaskClient;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.game.clans.clans.ClanInfo;
|
||||
import mineplex.game.clans.clans.ClanRole;
|
||||
@ -27,14 +30,11 @@ import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.ClientClan;
|
||||
import mineplex.game.clans.clans.event.ClanJoinEvent;
|
||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||
import mineplex.game.clans.tutorials.Tutorial;
|
||||
import mineplex.game.clans.tutorials.TutorialManager;
|
||||
import net.minecraft.server.v1_8_R3.EnumDirection;
|
||||
|
||||
public class ClansCommand extends CommandBase<ClansManager>
|
||||
{
|
||||
private ClansManager _manager;
|
||||
|
||||
public ClansCommand(ClansManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ALL, "c", "clan", "clans", "factions");
|
||||
@ -127,7 +127,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
private void forceJoin(Player caller, String[] args)
|
||||
{
|
||||
if (!Plugin.getClientManager().hasRank(caller, Rank.ADMIN) && !caller.getName().equals("NewGarbo"))
|
||||
if (!Plugin.getClientManager().hasRank(caller, Rank.ADMIN) && !caller.getUniqueId().toString().equals("d8646a35-33a8-43c6-9e7c-2e871a6b86c9"))
|
||||
{
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This requires ADMIN+ permission."));
|
||||
return;
|
||||
@ -741,7 +741,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
Plugin.getItemMapManager().setMap(caller);
|
||||
}
|
||||
|
||||
public void home(Player caller, String[] args)
|
||||
public void home(final Player caller, String[] args)
|
||||
{
|
||||
if (args.length > 1)
|
||||
{
|
||||
@ -752,7 +752,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
}
|
||||
}
|
||||
|
||||
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
||||
final ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
@ -772,18 +772,6 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Plugin.getClanUtility().isSafe(caller.getLocation()))
|
||||
{
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You can only use Clan Home from Spawn."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Plugin.getClanUtility().isSpecial(caller.getLocation(), "Spawn"))
|
||||
{
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You can only use Clan Home from Spawn."));
|
||||
return;
|
||||
}
|
||||
|
||||
Location home = clan.getHome();
|
||||
|
||||
if (!(home.getBlock().getType().equals(Material.BED_BLOCK) && home.add(0, 1, 0).getBlock().getType().equals(Material.AIR)) && home.add(0, 2, 0).getBlock().getType().equals(Material.AIR))
|
||||
@ -802,14 +790,31 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
* }
|
||||
*/
|
||||
|
||||
// if (!Recharge.Instance.use(caller, "Clans Teleport", "Clans
|
||||
// Teleport", 300000, true, false, false, false)) return;
|
||||
if (!Recharge.Instance.use(caller, "Home Teleport", 5 * 60 * 1000, true, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Do
|
||||
Plugin.getTeleport().TP(caller, clan.getHome().add(0, 1, 0));
|
||||
DelayedTask.Instance.doDelay(caller, "Home Teleport", new Callback<DelayedTaskClient>() {
|
||||
public void run(DelayedTaskClient player)
|
||||
{
|
||||
// Do
|
||||
Plugin.getTeleport().TP(caller, clan.getHome().add(0, 1, 0));
|
||||
|
||||
// Inform
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
|
||||
// Inform
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
|
||||
}
|
||||
}, new Callback<DelayedTaskClient>() {
|
||||
public void run(DelayedTaskClient client)
|
||||
{
|
||||
UtilTextMiddle.display("", "Teleporting to Clan Home in " + F.elem(UtilTime.MakeStr(Math.max(0, client.getTimeLeft("Home Teleport")))), 0, 5, 0, client.getPlayer());
|
||||
}
|
||||
}, new Callback<DelayedTaskClient>() {
|
||||
public void run(DelayedTaskClient client)
|
||||
{
|
||||
UtilPlayer.message(client.getPlayer(), F.main("Clans", "Teleport has been cancelled due to movement."));
|
||||
}
|
||||
}, (Plugin.getClanUtility().getClaim(caller.getLocation()) != null ? 30 : 20) * 1000, false);
|
||||
}
|
||||
|
||||
public void homeSet(Player caller)
|
||||
@ -881,7 +886,9 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
}
|
||||
|
||||
public void infoClan(Player caller, String search)
|
||||
{System.out.println(search);
|
||||
{
|
||||
System.out.println(search);
|
||||
|
||||
if (search == null)
|
||||
{
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a search parameter."));
|
||||
|
@ -0,0 +1,22 @@
|
||||
package mineplex.game.clans.clans.commands;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.game.clans.clans.outpost.Outpost;
|
||||
import mineplex.game.clans.clans.outpost.OutpostManager;
|
||||
|
||||
public class Meow extends CommandBase<OutpostManager>
|
||||
{
|
||||
public Meow(OutpostManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ALL, "meow");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
caller.getInventory().addItem(Outpost.OUTPOST_ITEM);
|
||||
}
|
||||
}
|
@ -12,9 +12,11 @@ public class PlayerEnterTerritoryEvent extends Event
|
||||
private String _lastTerritory;
|
||||
private Player _player;
|
||||
|
||||
private boolean _sendMessage;
|
||||
|
||||
private boolean _safe;
|
||||
|
||||
public PlayerEnterTerritoryEvent(Player player, String lastTerritory, String newTerritory, boolean safe)
|
||||
public PlayerEnterTerritoryEvent(Player player, String lastTerritory, String newTerritory, boolean safe, boolean sendMessage)
|
||||
{
|
||||
_player = player;
|
||||
_lastTerritory = lastTerritory;
|
||||
@ -27,6 +29,16 @@ public class PlayerEnterTerritoryEvent extends Event
|
||||
return _player;
|
||||
}
|
||||
|
||||
public boolean willSendMessage()
|
||||
{
|
||||
return _sendMessage;
|
||||
}
|
||||
|
||||
public void setSendMessage(boolean flag)
|
||||
{
|
||||
_sendMessage = flag;
|
||||
}
|
||||
|
||||
public String getLastTerritory()
|
||||
{
|
||||
return _lastTerritory;
|
||||
|
@ -31,7 +31,7 @@ public class ClanWhoPage extends ClanPageBase
|
||||
|
||||
public ClanWhoPage(ClansManager plugin, ClanShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player, ClanInfo lookupClan, boolean showBackButton)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, lookupClan.getName(), player, 36);
|
||||
super(plugin, shop, clientManager, donationManager, lookupClan.getName(), player, 45);
|
||||
_lookupClan = lookupClan;
|
||||
_showBackButton = showBackButton;
|
||||
|
||||
|
@ -0,0 +1,451 @@
|
||||
package mineplex.game.clans.clans.outpost;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.ColorFader;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.LoopIterator;
|
||||
import mineplex.core.common.util.NonFinalInteger;
|
||||
import mineplex.core.common.util.RGBData;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilColor;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClanInfo;
|
||||
import mineplex.game.clans.clans.ClansBlacklist;
|
||||
import mineplex.game.clans.core.repository.ClanTerritory;
|
||||
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
|
||||
|
||||
public class Outpost implements Listener
|
||||
{
|
||||
protected static final long MAX_LIFETIME = 5 * 60 * 1000; // 30 minutes
|
||||
public static final ItemStack OUTPOST_ITEM = new ItemBuilder(Material.NETHERRACK, 1).setRawTitle(C.cBlue + "Outpost").setLore("Seems to be a mystical contraption of some sort!").build();
|
||||
public static final byte OUTPOST_BLOCK_DATA = (byte) 137;
|
||||
|
||||
private OutpostManager _host;
|
||||
|
||||
private ClanInfo _clan;
|
||||
|
||||
private Location _startCorner;
|
||||
private Location _origin;
|
||||
private Location _endCorner;
|
||||
|
||||
private Location _forceFieldStart;
|
||||
private Location _forceFieldEnd;
|
||||
|
||||
private Location _core;
|
||||
|
||||
private LinkedHashMap<String, OutpostBlock> _blocks;
|
||||
private LinkedHashMap<String, OutpostBlock> _buildQueue;
|
||||
|
||||
private OutpostType _type;
|
||||
private OutpostState _state;
|
||||
|
||||
private Hologram _preHologram;
|
||||
private Hologram _preHologram2;
|
||||
|
||||
private LoopIterator<Vector> _circleStages;
|
||||
private LoopIterator<Vector> _reverseCircleStages;
|
||||
|
||||
private ColorFader _fader = new ColorFader(30, UtilColor.hexToRgb(0x00A296), UtilColor.hexToRgb(0x29E6B6));
|
||||
|
||||
private long _spawnTime;
|
||||
|
||||
public Outpost(OutpostManager host, ClanInfo clan, Location location, OutpostType type)
|
||||
{
|
||||
_host = host;
|
||||
|
||||
_clan = clan;
|
||||
|
||||
_startCorner = location.clone().subtract(type._size, 1, type._size);
|
||||
_endCorner = location.clone().add(type._size + .9, type._ySize - 1, type._size + .9);
|
||||
|
||||
_forceFieldStart = _startCorner.clone().subtract(3, 0, 3);
|
||||
_forceFieldEnd = _endCorner.clone().add(3, 0, 3);
|
||||
|
||||
_origin = location.clone();
|
||||
|
||||
_type = type;
|
||||
|
||||
_spawnTime = System.currentTimeMillis();
|
||||
|
||||
_core = _type.getCoreLocation(_origin);
|
||||
|
||||
_preHologram = new Hologram(_clan.Clans.getHologramManager(), _origin.clone().add(0.5, 2.3, 0.5), F.elem(_clan.getName()) + C.cWhite + "'s Outpost block");
|
||||
_preHologram2 = new Hologram(_clan.Clans.getHologramManager(), _origin.clone().add(0.5, 3, 0.5), "Despawning: " + UtilText.getProgress(null, 0, null, true));
|
||||
|
||||
_preHologram.start();
|
||||
_preHologram2.start();
|
||||
|
||||
_state = OutpostState.AWAITING;
|
||||
}
|
||||
|
||||
private void cleanup()
|
||||
{
|
||||
_blocks = null;
|
||||
|
||||
if (_preHologram != null) _preHologram.stop();
|
||||
if (_preHologram2 != null) _preHologram2.stop();
|
||||
|
||||
_preHologram = null;
|
||||
_preHologram2 = null;
|
||||
|
||||
_state = OutpostState.DEAD;
|
||||
|
||||
_host.queueForRemoval(_clan.getName());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (getState() != OutpostState.AWAITING)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (getLifetime() <= 2000)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_clan.equals(_clan.Clans.getClanUtility().getClanByPlayer(event.getPlayer())))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Clans", "This is not yours to activate!"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getClickedBlock() != null && _origin.equals(event.getClickedBlock().getLocation()))
|
||||
{
|
||||
if (event.getClickedBlock().getType().equals(Material.NETHERRACK))
|
||||
{
|
||||
_origin.getBlock().setType(Material.AIR);
|
||||
beginConstruction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockDamage(BlockDamageEvent event)
|
||||
{
|
||||
if (event.getBlock().getLocation().equals(_core) && getState() == OutpostState.LIVE)
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You have destroyed " + F.elem(_clan.getName()) + "'s Outpost!"));
|
||||
|
||||
_core.getBlock().setType(Material.AIR);
|
||||
|
||||
_clan.inform("Your Outpost has been destroyed!", null);
|
||||
UtilTextMiddle.display("Siege", "Your Outpost has been destroyed", 20, 100, 20, _clan.getOnlinePlayersArray());
|
||||
|
||||
if (getState() == OutpostState.AWAITING)
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
else
|
||||
{
|
||||
kill();
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
if (getState() == OutpostState.AWAITING && event.getBlock().getLocation().equals(_origin))
|
||||
{
|
||||
_origin.getBlock().setType(Material.AIR);
|
||||
_origin.getWorld().dropItem(_origin, OUTPOST_ITEM);
|
||||
_clan.inform("Your Outpost block has been destroyed.", null);
|
||||
cleanup();
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
_blocks.values().stream().filter(event.getBlock().getLocation()::equals).forEach(block -> {
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You may not break blocks in Outposts."));
|
||||
event.setCancelled(true);
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event)
|
||||
{
|
||||
if (UtilAlg.inBoundingBox(event.getBlock().getLocation(), _startCorner, _endCorner))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You may not place blocks in Outposts."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
protected void update()
|
||||
{
|
||||
if (_state == OutpostState.AWAITING)
|
||||
{
|
||||
if (getLifetime() > 60000)
|
||||
{
|
||||
_origin.getBlock().setType(Material.AIR);
|
||||
_clan.inform("You have lost your Outpost block, as no one activated it fast enough!", null);
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
_preHologram2.setText(UtilText.getProgress(null, UtilMath.clamp(getLifetime(), 0., 60000.) / 60000., null, true));
|
||||
|
||||
RGBData color = UtilColor.RgbLightBlue;
|
||||
|
||||
for (int x = -_type._size; x <= _type._size; x++)
|
||||
{
|
||||
for (int z = -_type._size; z <= _type._size; z++)
|
||||
{
|
||||
if (x == -_type._size || x == _type._size || z == -_type._size || z == _type._size)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, UtilBlock.getHighest(_origin.getWorld(), _origin.clone().add(x + .5, .1, z + .5).getBlockX(), _origin.clone().add(x + .5, .1, z + .5).getBlockZ()).getLocation().add(0.5, 0, 0.5), new Vector(color.getRed(), color.getGreen(), color.getBlue()), 1f, 0, ViewDist.NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (_state == OutpostState.CONSTRUCTING)
|
||||
{
|
||||
if (_buildQueue.isEmpty())
|
||||
{
|
||||
_state = OutpostState.LIVE;
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Iterator<String> iterator = _buildQueue.keySet().iterator();
|
||||
|
||||
if (iterator.hasNext())
|
||||
{
|
||||
_buildQueue.remove(iterator.next()).set();
|
||||
}
|
||||
}
|
||||
|
||||
// Forcefield
|
||||
RGBData color = UtilColor.RgbLightBlue;
|
||||
|
||||
for (int x = -_type._size; x <= _type._size; x++)
|
||||
{
|
||||
for (int z = -_type._size; z <= _type._size; z++)
|
||||
{
|
||||
if (x == -_type._size || x == _type._size || z == -_type._size || z == _type._size)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, _origin.clone().add(x + .5, .1, z + .5), new Vector(color.getRed(), color.getGreen(), color.getBlue()), 1f, 0, ViewDist.NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RGBData next = _fader.next();
|
||||
|
||||
{
|
||||
RGBData color = _state == OutpostState.LIVE ? next : UtilColor.RgbRed;
|
||||
|
||||
Vector nextCircleStage = _circleStages.next();
|
||||
|
||||
double circleX = nextCircleStage.getX();
|
||||
double circleZ = nextCircleStage.getZ();
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.MOB_SPELL, _core.clone().add(circleX + .5, 1.1d, circleZ + .5), new Vector(color.getRed(), color.getGreen(), color.getBlue()), 5.f, 0, ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
{
|
||||
RGBData color = _state == OutpostState.LIVE ? next : UtilColor.RgbRed;
|
||||
|
||||
Vector nextCircleStage = _reverseCircleStages.next();
|
||||
|
||||
double circleX = nextCircleStage.getX();
|
||||
double circleZ = nextCircleStage.getZ();
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.MOB_SPELL, _core.clone().add(circleX + .5, 1.1d, circleZ + .5), new Vector(color.getRed(), color.getGreen(), color.getBlue()), 5.f, 0, ViewDist.NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void forcefield(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST && getState() == OutpostState.CONSTRUCTING)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UtilServer.getPlayersCollection().stream()
|
||||
.filter(player -> !_clan.isMember(player))
|
||||
.filter(player -> UtilAlg.inBoundingBox(player.getLocation(), _forceFieldStart, _forceFieldEnd))
|
||||
.forEach(player -> {
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory2d(_core, player.getLocation()), 1, true, 0.8, 0, 1.1, true);
|
||||
UtilPlayer.message(player, F.main("Clans", "This Outpost is still under construction!"));
|
||||
player.playSound(player.getLocation(), Sound.NOTE_BASS, 1.0f, 1.0f);
|
||||
});
|
||||
}
|
||||
|
||||
public void beginConstruction()
|
||||
{
|
||||
// Cleanup pre-Outpost stuff
|
||||
_preHologram.stop();
|
||||
_preHologram2.stop();
|
||||
|
||||
_preHologram = null;
|
||||
_preHologram = null;
|
||||
|
||||
_state = OutpostState.CONSTRUCTING;
|
||||
_blocks = new LinkedHashMap<>(_buildQueue = _type.createBuildQueue(_origin, _clan.Clans));
|
||||
|
||||
_clan.inform("Siege", "Your Outpost is now being constructed.", null);
|
||||
|
||||
_circleStages = new LoopIterator<Vector>(circleAround(new Vector(0., 0., 0.), 40, .6d));
|
||||
|
||||
List<Vector> reverse = circleAround(new Vector(0., 0., 0.), 40, .6d);
|
||||
Collections.reverse(reverse);
|
||||
_reverseCircleStages = new LoopIterator<Vector>(reverse);
|
||||
|
||||
//Inform nearby Clans
|
||||
for (int chunkX = -3; chunkX < 3; chunkX++)
|
||||
{
|
||||
for (int chunkZ = -3; chunkZ < 3; chunkZ++)
|
||||
{
|
||||
ClanTerritory territory = _clan.Clans.getClanUtility().getClaim(_origin.getWorld().getChunkAt(_origin.getChunk().getX() + chunkX, _origin.getChunk().getZ() + chunkZ));
|
||||
|
||||
if (territory != null && ClansBlacklist.isValidClanName(territory.Owner))
|
||||
{
|
||||
ClanInfo clan = _clan.Clans.getClanUtility().getClanByClanName(territory.Owner);
|
||||
|
||||
clan.inform("A siege has begun near your territory!", null);
|
||||
UtilTextMiddle.display("Siege", "A Siege has been declared on your Clan!", 20, 100, 20, clan.getOnlinePlayersArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<Vector> circleAround(Vector origin, int points, double radius)
|
||||
{
|
||||
List<Vector> list = new LinkedList<>();
|
||||
|
||||
double slice = 2 * Math.PI / points;
|
||||
|
||||
for (int point = 0; point < points; point++)
|
||||
{
|
||||
double angle = slice * point;
|
||||
list.add(new Vector(origin.getX() + radius * Math.cos(angle), 0, origin.getZ() + radius * Math.sin(angle)));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public void instakill()
|
||||
{
|
||||
_blocks.values().forEach(OutpostBlock::restore);
|
||||
|
||||
cleanup();
|
||||
}
|
||||
|
||||
public void kill()
|
||||
{
|
||||
_state = OutpostState.DESTRUCTING;
|
||||
|
||||
NonFinalInteger wait = new NonFinalInteger(0);
|
||||
|
||||
_blocks.values().stream().filter(block -> UtilMath.random.nextBoolean() || UtilMath.random.nextBoolean() || UtilMath.random.nextBoolean() || UtilMath.random.nextBoolean()).forEach(block ->
|
||||
_host.runSyncLater(() -> {
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, block._loc, new Vector(0,0,0), 1f, 1, ViewDist.NORMAL);
|
||||
_origin.getWorld().playSound(block._loc, Sound.EXPLODE, 1.0f, 1.0f);
|
||||
}, wait.add(4 + UtilMath.random.nextInt(4)).get())
|
||||
);
|
||||
|
||||
_host.runSyncLater(() -> {
|
||||
_blocks.values().forEach(block -> {
|
||||
Material mat = Material.getMaterial(block._id);
|
||||
|
||||
if (UtilItem.isTranslucent(mat))
|
||||
{
|
||||
block.restore();
|
||||
return;
|
||||
}
|
||||
|
||||
FallingBlock fall = block._loc.getWorld().spawnFallingBlock(block._loc, block._id, block._data);
|
||||
fall.setDropItem(false);
|
||||
Vector vec = UtilAlg.getTrajectory(fall.getLocation(), getExactMiddle());
|
||||
|
||||
UtilAction.velocity(fall, vec, 1, false, 0, 0.6, 10, false);
|
||||
|
||||
fall.setMetadata("ClansOutpost", new FixedMetadataValue(_clan.Clans.getPlugin(), _clan.getName()));
|
||||
|
||||
block.restore();
|
||||
});
|
||||
|
||||
cleanup();
|
||||
}, wait.get() + 5L);
|
||||
|
||||
_clan.inform("Your Clan's Outpost has been destroyed.", null);
|
||||
}
|
||||
|
||||
public ClanInfo getClan()
|
||||
{
|
||||
return _clan;
|
||||
}
|
||||
|
||||
public long getLifetime()
|
||||
{
|
||||
return System.currentTimeMillis() - _spawnTime;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getBounds()
|
||||
{
|
||||
return UtilAlg.toBoundingBox(_startCorner, _endCorner);
|
||||
}
|
||||
|
||||
public Location getExactMiddle()
|
||||
{
|
||||
return UtilAlg.getMidpoint(_startCorner, _endCorner);
|
||||
}
|
||||
|
||||
public OutpostState getState()
|
||||
{
|
||||
return _state;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package mineplex.game.clans.clans.outpost;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
|
||||
public class OutpostBlock
|
||||
{
|
||||
protected Location _loc;
|
||||
protected int _id;
|
||||
protected byte _data;
|
||||
|
||||
protected int _originalId;
|
||||
protected byte _originalData;
|
||||
|
||||
public OutpostBlock(Map<String, OutpostBlock> blocks, Location loc, int id, byte data)
|
||||
{
|
||||
_loc = loc;
|
||||
_id = id;
|
||||
_data = data;
|
||||
|
||||
String locStr = UtilWorld.locToStr(loc);
|
||||
|
||||
if (blocks.containsKey(locStr))
|
||||
{
|
||||
_originalId = blocks.get(locStr)._originalId;
|
||||
_originalData = blocks.get(locStr)._originalData;
|
||||
}
|
||||
else
|
||||
{
|
||||
_originalId = _loc.getBlock().getTypeId();
|
||||
_originalData = _loc.getBlock().getData();
|
||||
}
|
||||
}
|
||||
|
||||
public void set()
|
||||
{
|
||||
_loc.getBlock().setTypeIdAndData(_id, _data, false);
|
||||
if (_id != 0)
|
||||
{
|
||||
_loc.getWorld().playEffect(_loc, Effect.STEP_SOUND, Material.getMaterial(_id), 10);
|
||||
}
|
||||
}
|
||||
|
||||
public void restore()
|
||||
{
|
||||
BlockState state = _loc.getBlock().getState();
|
||||
state.setTypeId(_originalId);
|
||||
state.setRawData(_originalData);
|
||||
state.update(true, false);
|
||||
}
|
||||
}
|
@ -0,0 +1,218 @@
|
||||
package mineplex.game.clans.clans.outpost;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.events.ServerShutdownEvent;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClanInfo;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
|
||||
|
||||
public class OutpostManager extends MiniPlugin
|
||||
{
|
||||
private ClansManager _clansManager;
|
||||
|
||||
private Map<String, Outpost> _outposts = new HashMap<>();
|
||||
|
||||
private List<String> _removalQueue;
|
||||
|
||||
public OutpostManager(ClansManager clansManager)
|
||||
{
|
||||
super("Outpost Manager", clansManager.getPlugin());
|
||||
|
||||
_clansManager = clansManager;
|
||||
|
||||
_removalQueue = new ArrayList<>();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlaceBlock(BlockPlaceEvent event)
|
||||
{
|
||||
if (event.getItemInHand().isSimilar(Outpost.OUTPOST_ITEM))
|
||||
{
|
||||
if (!Recharge.Instance.use(event.getPlayer(), "Place Outpost", 10000, true, false))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Spawn(event.getPlayer(), event.getBlock().getLocation(), OutpostType.ORIGINAL_CLANS))
|
||||
{
|
||||
event.getBlock().setData((byte) Outpost.OUTPOST_BLOCK_DATA);
|
||||
}
|
||||
else
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean Spawn(Player player, Location location, OutpostType type)
|
||||
{
|
||||
if (!_clansManager.isInClan(player))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "You must be in a Clan to place an Outpost."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (location.getBlockY() < 10)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "You cannot place an Outpost this deep."));
|
||||
return false;
|
||||
}
|
||||
|
||||
ClanInfo clan = _clansManager.getClan(player);
|
||||
|
||||
if (UtilItem.isBoundless(location.clone().subtract(0, 1, 0).getBlock().getType()))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "An Outpost must not be placed floating."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Get(clan) != null)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "Your clan already has an outpost"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_clansManager.getClanUtility().getClaim(location) != null)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "An Outpost must be placed in the Wilderness."));
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Outpost outpost : _outposts.values())
|
||||
{
|
||||
if (UtilMath.offset(location, outpost.getExactMiddle()) < 14)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "You cannot place an Outpost near other Outposts."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (int x = -type._size; x < type._size; x++)
|
||||
{
|
||||
for (int y = -1; y < type._ySize; y++)
|
||||
{
|
||||
for (int z = -type._size; z < type._size; z++)
|
||||
{
|
||||
Location loc = location.clone().add(x, y, z);
|
||||
|
||||
if (_clansManager.getClanUtility().isClaimed(loc))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "You cannot place an Outpost where it may intersect with claimed territory."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (UtilBlock.airFoliage(location.clone().add(x, -1, z).getBlock()))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "An Outpost cannot be placed floating."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_outposts.put(clan.getName(), new Outpost(this, clan, location, type));
|
||||
|
||||
_plugin.getServer().getPluginManager().registerEvents(_outposts.get(clan.getName()), _plugin);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockFall(EntityChangeBlockEvent event)
|
||||
{
|
||||
if (event.getEntity().hasMetadata("ClansOutpost"))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onServerShutdown(ServerShutdownEvent event)
|
||||
{
|
||||
for (Outpost outpost : _outposts.values())
|
||||
{
|
||||
outpost.instakill();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onClaim(PlayerClaimTerritoryEvent event)
|
||||
{
|
||||
for (Outpost outpost : _outposts.values())
|
||||
{
|
||||
if (outpost.getBounds().b(UtilAlg.toBoundingBox(event.getClaimedChunk().getBlock(0, 0, 0).getLocation(), event.getClaimedChunk().getBlock(15, 254, 15).getLocation())))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
UtilPlayer.message(event.getClaimer(), F.main("Clans", "You cannot claim this territory as it overlaps with " + F.elem(outpost.getClan().getName()) + "'s Outpost."));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
for (Outpost outpost : _outposts.values())
|
||||
{
|
||||
if (outpost.getState() != OutpostState.DEAD)
|
||||
{
|
||||
if (outpost.getState() == OutpostState.CONSTRUCTING ? event.getType() == UpdateType.FASTER : event.getType() == UpdateType.TICK)
|
||||
{
|
||||
outpost.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getType() == UpdateType.FASTER)
|
||||
{
|
||||
if (!_removalQueue.isEmpty())
|
||||
{
|
||||
HandlerList.unregisterAll(_outposts.remove(_removalQueue.remove(0)));
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getType() == UpdateType.TWOSEC)
|
||||
{
|
||||
for (Outpost outpost : _outposts.values())
|
||||
{
|
||||
if (outpost.getState() == OutpostState.LIVE && outpost.getLifetime() > Outpost.MAX_LIFETIME)
|
||||
{
|
||||
outpost.kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Outpost Get(ClanInfo clan)
|
||||
{
|
||||
return _outposts.get(clan.getName().toLowerCase());
|
||||
}
|
||||
|
||||
public void queueForRemoval(String name)
|
||||
{
|
||||
_removalQueue.add(name);
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package mineplex.game.clans.clans.outpost;
|
||||
|
||||
public enum OutpostState
|
||||
{
|
||||
AWAITING,
|
||||
CONSTRUCTING,
|
||||
LIVE,
|
||||
DESTRUCTING,
|
||||
DEAD;
|
||||
}
|
@ -0,0 +1,225 @@
|
||||
package mineplex.game.clans.clans.outpost;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
|
||||
public enum OutpostType
|
||||
{
|
||||
ORIGINAL_CLANS(3, 6) {
|
||||
public LinkedHashMap<String, OutpostBlock> createBuildQueue(Location location, ClansManager clans)
|
||||
{
|
||||
LinkedHashMap<String, OutpostBlock> build = new LinkedHashMap<>();
|
||||
|
||||
for (int y = -1; y <= _ySize; y++)
|
||||
{
|
||||
for (int x = -_size; x <= _size; x++)
|
||||
{
|
||||
for (int z = -_size; z <= _size; z++)
|
||||
{
|
||||
Location loc = new Location(location.getWorld(), location.getX()+x, location.getY()+y, location.getZ()+z);
|
||||
|
||||
if (clans.getClanUtility().isClaimed(loc))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean added = false;
|
||||
|
||||
//Floor
|
||||
if (y == -1 && Math.abs(x) <= _size-1 && Math.abs(z) <= _size-1)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 98, (byte)0));
|
||||
added = true;
|
||||
}
|
||||
|
||||
//Walls
|
||||
if (Math.abs(x) == _size || Math.abs(z) == _size)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 98, (byte)0));
|
||||
added = true;
|
||||
}
|
||||
|
||||
//Roof
|
||||
if (y == 5 && Math.abs(x) <= _size-1 && Math.abs(z) <= _size-1)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 44, (byte)13));
|
||||
added = true;
|
||||
}
|
||||
|
||||
//Clear
|
||||
if (!added)
|
||||
{
|
||||
if (loc.getBlock().getTypeId() != 0)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 0, (byte) 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int y= -1; y <= _ySize; y++)
|
||||
{
|
||||
for (int x = -_size; x <= _size; x++)
|
||||
{
|
||||
for (int z = -_size; z <= _size; z++)
|
||||
{
|
||||
Location loc = new Location(location.getWorld(), location.getX()+x, location.getY()+y, location.getZ()+z);
|
||||
|
||||
if (clans.getClanUtility().isClaimed(loc))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//Doors
|
||||
if (y == 0 || y == 1)
|
||||
{
|
||||
if (x == 0 && z == _size)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 71, (byte)(y * 8 + 2 + 4)));
|
||||
}
|
||||
|
||||
if (x == 0 && z == -_size)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 71, (byte)(y * 8 + 4)));
|
||||
}
|
||||
|
||||
if (x == _size && z == 0)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 71, (byte)(y * 8 + 3 + 4)));
|
||||
}
|
||||
|
||||
if (x == -_size && z == 0)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 71, (byte)(y * 8 + 1 + 4)));
|
||||
}
|
||||
}
|
||||
|
||||
//Platform
|
||||
if (y == 2)
|
||||
{
|
||||
if (Math.abs(x) == _size-1 && Math.abs(z) < _size)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 44, (byte)13));
|
||||
}
|
||||
|
||||
if (Math.abs(z) == _size-1 && Math.abs(x) < _size)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 44, (byte)13));
|
||||
}
|
||||
}
|
||||
|
||||
//Windows
|
||||
if (y == 4)
|
||||
{
|
||||
if (Math.abs(x) == _size && Math.abs(z) < _size-1)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 0, (byte)0));
|
||||
}
|
||||
|
||||
if (Math.abs(z) == _size && Math.abs(x) < _size-1)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 0, (byte)0));
|
||||
}
|
||||
}
|
||||
|
||||
//Ladders
|
||||
if (y >= 0 && y < 3)
|
||||
{
|
||||
if (x == _size-1 && z == _size-1)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 65, (byte)2));
|
||||
}
|
||||
|
||||
if (x == (-_size)+1 && z == (-_size)+1)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 65, (byte)3));
|
||||
}
|
||||
}
|
||||
|
||||
//Chests
|
||||
if (y == 0)
|
||||
{
|
||||
if (x == _size-1 && z == (-_size)+1)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 54, (byte)0));
|
||||
}
|
||||
|
||||
if (x == (-_size)+1 && z == _size-1)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 54, (byte)0));
|
||||
}
|
||||
|
||||
if (x == _size-2 && z == (-_size)+1)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 54, (byte)0));
|
||||
}
|
||||
|
||||
if (x == (-_size)+2 && z == _size-1)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 54, (byte)0));
|
||||
}
|
||||
}
|
||||
|
||||
//Beacon Floor
|
||||
if (y == -1)
|
||||
{
|
||||
if (Math.abs(x) <= 1 && Math.abs(z) <= 1)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 42, (byte)0));
|
||||
}
|
||||
}
|
||||
|
||||
//Beacon Roof
|
||||
if (y == 5)
|
||||
{
|
||||
if (Math.abs(x) == 1 && Math.abs(z) <= 1)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 98, (byte)0));
|
||||
}
|
||||
|
||||
if (Math.abs(z) == 1 && Math.abs(x) <= 1)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 98, (byte)0));
|
||||
}
|
||||
}
|
||||
|
||||
//Beacon Glass
|
||||
if (y == 5 && x == 0 && z == 0)
|
||||
{
|
||||
build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 20, (byte)0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Core
|
||||
build.put(UtilWorld.locToStr(getCoreLocation(location)), new OutpostBlock(build, getCoreLocation(location), Material.DIAMOND_BLOCK.getId(), (byte)0));
|
||||
|
||||
return build;
|
||||
}
|
||||
|
||||
public Location getCoreLocation(Location location)
|
||||
{
|
||||
return location.clone().subtract(0, 1, 0);
|
||||
}
|
||||
};
|
||||
|
||||
protected int _size;
|
||||
protected int _ySize;
|
||||
|
||||
OutpostType(int size, int ySize)
|
||||
{
|
||||
_size = size;
|
||||
_ySize = ySize;
|
||||
}
|
||||
|
||||
public abstract LinkedHashMap<String, OutpostBlock> createBuildQueue(Location location, ClansManager clans);
|
||||
|
||||
public abstract Location getCoreLocation(Location location);
|
||||
}
|
@ -1,13 +1,18 @@
|
||||
package mineplex.game.clans.clans.playtime;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.game.clans.clans.ClansPlayerTasks;
|
||||
|
||||
public class PlayingClient
|
||||
{
|
||||
public long StartTime;
|
||||
public boolean FirstSession;
|
||||
|
||||
public PlayingClient(boolean first)
|
||||
public PlayingClient(Player player, TaskManager taskManager)
|
||||
{
|
||||
StartTime = System.currentTimeMillis();
|
||||
FirstSession = first;
|
||||
FirstSession = taskManager.hasCompletedTask(player, ClansPlayerTasks.FIRST_SESSION.id());
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.ClansPlayerStats;
|
||||
import mineplex.game.clans.clans.playtime.command.PlayTimeCommand;
|
||||
@ -75,7 +76,7 @@ public class Playtime extends MiniClientPlugin<PlayingClient>
|
||||
@Override
|
||||
protected PlayingClient AddPlayer(String player)
|
||||
{
|
||||
return new PlayingClient(_statsManager.Get(player).getStat(ClansPlayerStats.PLAY_TIME.id()) == 0);
|
||||
return new PlayingClient(Bukkit.getPlayer(player), TaskManager.Instance);
|
||||
}
|
||||
|
||||
// Seconds
|
||||
|
@ -21,7 +21,7 @@ public class cemde extends CommandBase<StatsManager>
|
||||
@Override
|
||||
public void Execute(final Player caller, final String[] args)
|
||||
{
|
||||
Plugin.Get(caller).setStat(ClansPlayerStats.PLAY_TIME.id(), 0);
|
||||
Plugin.Get(caller).setStat(ClansPlayerStats.PLAY_TIME.id(), args.length == 0 ? 0 : Integer.parseInt(args[0]));
|
||||
_timer.Get(caller).Skipped = false;
|
||||
_timer.Get(caller).InformedTimes.clear();
|
||||
|
||||
|
@ -1,16 +1,23 @@
|
||||
package mineplex.game.clans.clans.pvptimer;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
@ -18,17 +25,26 @@ import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClanTips.TipType;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.ClanTipEvent;
|
||||
import mineplex.game.clans.clans.event.PlayerEnterTerritoryEvent;
|
||||
import mineplex.game.clans.clans.playtime.Playtime;
|
||||
import mineplex.game.clans.clans.playtime.command.cemde;
|
||||
import mineplex.game.clans.clans.pvptimer.command.PvPTimerCommand;
|
||||
import mineplex.game.clans.core.repository.ClanTerritory;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||
import mineplex.minecraft.game.classcombat.event.FireballHitEntityEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
public class PvpTimer extends MiniClientPlugin<PvpTimerClient>
|
||||
{
|
||||
private Playtime _tracker;
|
||||
|
||||
public static final String SKIPPED_TASK = "PvpTimer.Skipped";
|
||||
private final int[] DISPLAY_TIMES = { 5, 10, 30, 1 * 60, 2 * 60, 5 * 60, 10 * 60, 20 * 60 };
|
||||
|
||||
private ClansManager _clansManager;
|
||||
private Playtime _tracker;
|
||||
|
||||
private static long TIMER_LENGTH = 30 * 60;
|
||||
|
||||
@ -36,6 +52,7 @@ public class PvpTimer extends MiniClientPlugin<PvpTimerClient>
|
||||
{
|
||||
super("PvP Timer", clans.getPlugin());
|
||||
_tracker = playtime;
|
||||
_clansManager = clans;
|
||||
|
||||
addCommand(new cemde(statsManager, this));
|
||||
}
|
||||
@ -58,6 +75,59 @@ public class PvpTimer extends MiniClientPlugin<PvpTimerClient>
|
||||
}, caller, "PvpTimer.Skipped");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void outYouGo(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.SEC)
|
||||
{
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (!hasTimer(player)) continue;
|
||||
|
||||
ClanTerritory territory = _clansManager.getClanUtility().getClaim(player.getLocation());
|
||||
|
||||
if (territory != null && territory.Owner.equals("Borderlands"))
|
||||
{
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), Spawn.ORIGIN), 2.6, true, 0.5, 1, 1.35, true);
|
||||
player.playSound(player.getLocation(), Sound.NOTE_BASS, 1.0f, 1.0f);
|
||||
|
||||
UtilPlayer.message(player, " ");
|
||||
|
||||
UtilPlayer.message(player, C.cDRedB + ">>" + C.cRed + " You are not permitted to enter the Borderlands while under PvP Safety.");
|
||||
|
||||
new JsonMessage(C.cGoldB + "> " + C.cGold + "To permanently disable PvP Safety, click ")
|
||||
.extra("here")
|
||||
.color("yellow")
|
||||
.click(ClickEvent.RUN_COMMAND, "/pvptimer yesiconfirmthatiwouldliketodisablemypvptimerforever")
|
||||
.extra(".")
|
||||
.color("gray")
|
||||
.sendToPlayer(player);
|
||||
|
||||
UtilPlayer.message(player, " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void territoryEnter(PlayerEnterTerritoryEvent event)
|
||||
{
|
||||
String from = event.getLastTerritory();
|
||||
String to = event.getNewTerritory();
|
||||
|
||||
if (from == null && "Borderlands".equals(to)
|
||||
|| to == null && "Borderlands".equals(from))
|
||||
{
|
||||
event.setSendMessage(false);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void clanTip(ClanTipEvent event)
|
||||
{
|
||||
event.setCancelled(hasTimer(event.getPlayer()) && event.getTip() == TipType.ENTER_BORDERLANDS);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
@ -68,13 +138,13 @@ public class PvpTimer extends MiniClientPlugin<PvpTimerClient>
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() {
|
||||
public void run()
|
||||
{
|
||||
UtilTextMiddle.display(C.cGold + "PvP Timer", "will end in " + UtilTime.MakeStr(getPvPTimerLeft(player) * 1000), 40, 70, 40, player);
|
||||
UtilTextMiddle.display(C.cGreen + "PvP Safety", C.cGray + "will end in " + UtilTime.MakeStr(getPvPTimerLeft(player) * 1000), 40, 70, 40, player);
|
||||
}
|
||||
}, 10);
|
||||
|
||||
UtilPlayer.message(player, F.main("Clans", "You are currently on your PvP timer. It will end in " + F.elem(UtilTime.MakeStr(getPvPTimerLeft(player) * 1000))));
|
||||
UtilPlayer.message(player, F.main("Clans", "You are currently safe from PvP because you are a new player. This safety will end in " + F.elem(UtilTime.MakeStr(getPvPTimerLeft(player) * 1000))));
|
||||
UtilPlayer.message(player, F.main("Clans", "Until it ends, you are immune to, and unable to deal PvP damage."));
|
||||
UtilPlayer.message(player, F.main("Clans", "If you would like to disable the PvP timer permanently, then type " + F.elem("/pvptimer") + ", and follow the instructions given."));
|
||||
UtilPlayer.message(player, F.main("Clans", "If you would like to disable the PvP safety permanently, then type " + F.elem("/pvp") + "."));
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,67 +160,60 @@ public class PvpTimer extends MiniClientPlugin<PvpTimerClient>
|
||||
long time = getPvPTimerLeft(player);
|
||||
PvpTimerClient client = Get(player);
|
||||
|
||||
// end
|
||||
if (time <= 2)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "Your " + F.elem("Pvp Timer") + " has ended!"));
|
||||
UtilPlayer.message(player, F.main("Clans", "PvP Safety has ended!"));
|
||||
UtilPlayer.message(player, F.main("Clans", "You are now completely open to attacks, and you can also attack others."));
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 0.75f);
|
||||
continue;
|
||||
}
|
||||
// 5 secs
|
||||
else if (time <= 5 && !client.InformedTimes.contains(5))
|
||||
|
||||
for (int unit : DISPLAY_TIMES)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "Your " + F.elem("Pvp Timer") + " will end in " + F.time("5.0 Seconds")));
|
||||
UtilTextMiddle.display("Pvp Timer", "ending in 5 Seconds");
|
||||
client.InformedTimes.add(5);
|
||||
}
|
||||
// 10 secs
|
||||
else if (time <= 10 && !client.InformedTimes.contains(10))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "Your " + F.elem("Pvp Timer") + " will end in " + F.time("10.0 Seconds")));
|
||||
UtilTextMiddle.display("Pvp Timer", "ending in 10 Seconds");
|
||||
client.InformedTimes.add(10);
|
||||
}
|
||||
// 30 secs
|
||||
else if (time <= 30 && !client.InformedTimes.contains(30))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "Your " + F.elem("Pvp Timer") + " will end in " + F.time("30.0 Seconds")));
|
||||
UtilTextMiddle.display("Pvp Timer", "ending in 30 Seconds");
|
||||
client.InformedTimes.add(30);
|
||||
}
|
||||
// 1 minute
|
||||
else if (time <= 1 * 60 && !client.InformedTimes.contains(1 * 60))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "Your " + F.elem("Pvp Timer") + " will end in " + F.time("1.0 Minute")));
|
||||
UtilTextMiddle.display("Pvp Timer", "ending in 1 Minute");
|
||||
client.InformedTimes.add(5);
|
||||
}
|
||||
// 5 minutes
|
||||
else if (time <= 5 * 60 && !client.InformedTimes.contains(5 * 60))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "Your " + F.elem("Pvp Timer") + " will end in " + F.time("5.0 Minutes")));
|
||||
UtilTextMiddle.display("Pvp Timer", "ending in 5 Minutes");
|
||||
client.InformedTimes.add(5 * 60);
|
||||
}
|
||||
// 10 minutes
|
||||
else if (time <= 10 * 60 && !client.InformedTimes.contains(10 * 60))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "Your " + F.elem("Pvp Timer") + " will end in " + F.time("10.0 Minutes")));
|
||||
UtilTextMiddle.display("Pvp Timer", "ending in 10 Minutes");
|
||||
client.InformedTimes.add(10 * 60);
|
||||
}
|
||||
// 20 minutes
|
||||
else if (time <= 20 * 60 && !client.InformedTimes.contains(20 * 60))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "Your " + F.elem("Pvp Timer") + " will end in " + F.time("20.0 Minutes")));
|
||||
UtilTextMiddle.display("Pvp Timer", "ending in 20 Minutes");
|
||||
client.InformedTimes.add(20 * 60);
|
||||
if (time <= unit && !client.InformedTimes.contains(unit))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "PvP Safety will end in " + F.time(UtilTime.MakeStr(unit * 1000))));
|
||||
UtilTextMiddle.display(C.cGreen + "Pvp Safety", C.cGray + "ending in " + UtilTime.MakeStr(unit * 1000), 20, 80, 20, player);
|
||||
client.InformedTimes.add(unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSkill(SkillTriggerEvent event)
|
||||
{
|
||||
if (event.GetTargets() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.GetTargets().size() == 1
|
||||
&& event.GetTargets().get(0) instanceof Player
|
||||
&& hasTimer((Player) event.GetTargets().get(0)))
|
||||
{
|
||||
event.SetCancelled(true);
|
||||
}
|
||||
|
||||
for (Iterator<Entity> iterator = event.GetTargets().iterator(); iterator.hasNext();)
|
||||
{
|
||||
Entity entity = iterator.next();
|
||||
|
||||
if (entity instanceof Player && hasTimer((Player) entity))
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onFireballHit(FireballHitEntityEvent event)
|
||||
{
|
||||
event.setCancelled(event.getHitEntity() instanceof Player && hasTimer((Player) event.getHitEntity()));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerAttack(CustomDamageEvent event)
|
||||
{
|
||||
@ -170,12 +233,12 @@ public class PvpTimer extends MiniClientPlugin<PvpTimerClient>
|
||||
{
|
||||
if (damagerTimer)
|
||||
{
|
||||
UtilPlayer.message(damager, F.main("Clans", "You and " + F.name(victim.getName()) + " are still on your PvP timer. Type " + F.elem("/pvptimer") + " to disable."));
|
||||
UtilPlayer.message(damager, F.main("Clans", "You and " + F.name(victim.getName()) + " are still protected from PvP. Type " + F.elem("/pvp") + " to disable."));
|
||||
bothMsg = true;
|
||||
}
|
||||
else if (damager != null)
|
||||
{
|
||||
UtilPlayer.message(damager, F.main("Clans", F.name(victim.getName()) + " is still on their Pvp timer."));
|
||||
UtilPlayer.message(damager, F.main("Clans", F.name(victim.getName()) + " is still protected from PvP."));
|
||||
}
|
||||
|
||||
event.SetCancelled("Pvp Timer");
|
||||
@ -185,11 +248,11 @@ public class PvpTimer extends MiniClientPlugin<PvpTimerClient>
|
||||
{
|
||||
if (victimTimer)
|
||||
{
|
||||
if (!bothMsg) UtilPlayer.message(damager, F.main("Clans", "You and " + F.name(victim.getName()) + " are still on your PvP timer. Type " + F.elem("/pvptimer") + " to disable."));
|
||||
if (!bothMsg) UtilPlayer.message(damager, F.main("Clans", "You and " + F.name(victim.getName()) + " are still under PvP Safety. Type " + F.elem("/pvp") + " to disable."));
|
||||
}
|
||||
else if (damager != null)
|
||||
{
|
||||
UtilPlayer.message(damager, F.main("Clans", "You are still on your PvP timer."));
|
||||
UtilPlayer.message(damager, F.main("Clans", "You are still under PvP Safety."));
|
||||
}
|
||||
|
||||
event.SetCancelled("PvP Timer");
|
||||
|
@ -6,6 +6,7 @@ import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
@ -25,7 +26,7 @@ public class PvPTimerCommand extends CommandBase<PvpTimer>
|
||||
{
|
||||
if (Plugin.Get(caller).Skipped)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You have skipped your PvP timer."));
|
||||
UtilPlayer.message(caller, F.main("Clans", "You have permanently disabled PvP Safety."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -33,12 +34,12 @@ public class PvPTimerCommand extends CommandBase<PvpTimer>
|
||||
|
||||
if (pvpTimerLeft == 0)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Your PvP timer has ended."));
|
||||
UtilPlayer.message(caller, F.main("Clans", "PvP Safety has already ended."));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You have " + F.elem(UtilTime.MakeStr(pvpTimerLeft * 1000)) + " before your PvP timer runs out."));
|
||||
new JsonMessage(F.main("Clans", "If you would like to permanently disable Pvp timer, click "))
|
||||
UtilPlayer.message(caller, F.main("Clans", "You have " + F.elem(UtilTime.MakeStr(pvpTimerLeft * 1000)) + " before PvP Safety runs out for you."));
|
||||
new JsonMessage(F.main("Clans", "If you would like to permanently disable " + C.mBody + "PvP Safety, click "))
|
||||
.extra("here")
|
||||
.color("green")
|
||||
.click(ClickEvent.RUN_COMMAND, "/pvptimer yesiconfirmthatiwouldliketodisablemypvptimerforever")
|
||||
@ -53,7 +54,8 @@ public class PvPTimerCommand extends CommandBase<PvpTimer>
|
||||
if (args[0].equalsIgnoreCase("yesiconfirmthatiwouldliketodisablemypvptimerforever"))
|
||||
{
|
||||
Plugin.disableFor(caller);
|
||||
UtilPlayer.message(caller, F.main("Clans", "You have disabled your Pvp timer."));
|
||||
UtilPlayer.message(caller, F.main("Clans", "You have disabled PvP Safety."));
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are now completely open to attacks, and you can also attack others."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ public class ClansRegions extends MiniPlugin
|
||||
|
||||
if (_manager.getClaimMap().containsKey(chunkStr))
|
||||
{
|
||||
System.out.println("get claim map contains " + chunkStr);
|
||||
System.out.println("get claim map contains " + chunkStr); // this is really really slowing server startup down. just saying.
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1,20 +1,18 @@
|
||||
package mineplex.game.clans.gameplay;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.CraftItemEvent;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
public class CustomRecipes implements Listener
|
||||
{
|
||||
|
||||
private static final Material[] DISABLED_RECIPES = { Material.EXPLOSIVE_MINECART, Material.JUKEBOX, Material.FISHING_ROD };
|
||||
private static final Material[] DISABLED_RECIPES = { Material.EXPLOSIVE_MINECART, Material.JUKEBOX, Material.FISHING_ROD, Material.BED };
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerCraftItem(CraftItemEvent event)
|
||||
|
@ -10,7 +10,6 @@ import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -39,6 +38,7 @@ import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.event.player.PlayerFishEvent.State;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.weather.WeatherChangeEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -65,6 +65,7 @@ import mineplex.core.common.weight.WeightSet;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.BlockTossEvent;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.BlockTossLandEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
|
||||
@ -101,6 +102,20 @@ public class Gameplay extends MiniPlugin
|
||||
// }
|
||||
// }
|
||||
|
||||
@EventHandler
|
||||
public void stopBlockTossExploit(BlockTossLandEvent event)
|
||||
{
|
||||
int id = event.Entity.getBlockId();
|
||||
if (_clansManager.getClanUtility().isClaimed(event.getLocation())
|
||||
&& (Material.getMaterial(id).name().endsWith("_PLATE")
|
||||
|| id == Material.STONE_BUTTON.getId()
|
||||
|| id == Material.WOOD_BUTTON.getId()
|
||||
|| id == Material.LEVER.getId()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerFishing(PlayerFishEvent event)
|
||||
{
|
||||
@ -434,7 +449,7 @@ public class Gameplay extends MiniPlugin
|
||||
{
|
||||
final Block block = event.getBlock();
|
||||
|
||||
if (_clansManager.getClanUtility().isSafe(block.getLocation()))
|
||||
if (_clansManager.getClanUtility().getClaim(block.getLocation()) != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -471,15 +486,9 @@ public class Gameplay extends MiniPlugin
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void killRain(UpdateEvent event)
|
||||
public void killRain(WeatherChangeEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TWOSEC){
|
||||
for (World world : Bukkit.getWorlds()){
|
||||
world.setWeatherDuration(0);
|
||||
world.setThunderDuration(0);
|
||||
world.setThundering(false);
|
||||
}
|
||||
}
|
||||
event.setCancelled(event.toWeatherState());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -10,7 +10,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilFile;
|
||||
import mineplex.core.common.util.UtilFile.ChunkType;
|
||||
@ -19,8 +18,8 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.ClanTips.TipType;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.gameplay.safelog.npc.NPCManager;
|
||||
|
||||
public class SafeLog extends MiniPlugin
|
||||
@ -96,8 +95,7 @@ public class SafeLog extends MiniPlugin
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
event.setQuitMessage(null);
|
||||
UtilServer.broadcast(F.sys("Quit", event.getPlayer().getName()));
|
||||
event.setQuitMessage(F.sys("Quit", event.getPlayer().getName()));
|
||||
|
||||
onPlayerQuit(event.getPlayer());
|
||||
}
|
||||
@ -105,8 +103,7 @@ public class SafeLog extends MiniPlugin
|
||||
@EventHandler
|
||||
public void onPlayerKicked(PlayerKickEvent event)
|
||||
{
|
||||
event.setLeaveMessage(null);
|
||||
UtilServer.broadcast(F.sys("Quit", event.getPlayer().getName()));
|
||||
event.setLeaveMessage(F.sys("Quit", event.getPlayer().getName()));
|
||||
|
||||
onPlayerQuit(event.getPlayer());
|
||||
}
|
||||
@ -115,7 +112,6 @@ public class SafeLog extends MiniPlugin
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
event.setJoinMessage(null);
|
||||
UtilServer.broadcast(F.sys("Join", event.getPlayer().getName()));
|
||||
|
||||
onPlayerJoin(event.getPlayer());
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -20,7 +21,6 @@ import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilFile;
|
||||
import mineplex.core.common.util.UtilFile.ChunkType;
|
||||
import mineplex.core.common.util.UtilFile.DataFileChunk;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
@ -28,6 +28,8 @@ import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.game.clans.Clans;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
|
||||
public class CombatLogNPC
|
||||
{
|
||||
@ -188,6 +190,7 @@ public class CombatLogNPC
|
||||
{
|
||||
Location spawnLoc = player.getLocation();
|
||||
Skeleton skel = player.getWorld().spawn(spawnLoc, Skeleton.class);
|
||||
skel.setMetadata("CombatLogNPC", new FixedMetadataValue(ClansManager.getInstance().getPlugin(), player.getUniqueId().toString()));
|
||||
skel.teleport(spawnLoc);
|
||||
skel.setHealth(_spawnHealth);
|
||||
UtilEnt.Vegetate(skel);
|
||||
|
@ -8,10 +8,12 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
@ -20,6 +22,7 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClanInfo;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
public class NPCManager extends MiniPlugin
|
||||
@ -74,6 +77,18 @@ public class NPCManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void killNpcs(PlayerJoinEvent event)
|
||||
{
|
||||
for (LivingEntity entity : Spawn.getSpawnWorld().getLivingEntities())
|
||||
{
|
||||
if (entity.hasMetadata("CombatLogNPC"))
|
||||
{
|
||||
entity.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void despawnLogoutNpc(Player player)
|
||||
{
|
||||
CombatLogNPC npc = getLogoutNpc(player);
|
||||
|
@ -55,6 +55,8 @@ public class CustomItem
|
||||
|
||||
private boolean _dullEnchantment;
|
||||
|
||||
public String OriginalOwner = null;
|
||||
|
||||
public String getUuid()
|
||||
{
|
||||
return _uuid;
|
||||
|
@ -8,7 +8,9 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -23,6 +25,7 @@ import com.google.gson.GsonBuilder;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
@ -64,7 +67,6 @@ import mineplex.game.clans.items.legendaries.WindBlade;
|
||||
import mineplex.game.clans.items.smelting.SmeltingListener;
|
||||
import mineplex.game.clans.items.ui.GearShop;
|
||||
import mineplex.serverdata.serialization.RuntimeTypeAdapterFactory;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSetSlot;
|
||||
@ -361,6 +363,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
System.out.println("==========");
|
||||
System.out.println("GearManager parse problem :");
|
||||
System.out.println(serialization);
|
||||
@ -481,7 +484,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
|
||||
if (packet instanceof PacketPlayOutSetSlot)
|
||||
{
|
||||
PacketPlayOutSetSlot slotPacket = (PacketPlayOutSetSlot) packet;
|
||||
slotPacket.c = maskItem(slotPacket.c); // Mask all out-going item
|
||||
slotPacket.c = maskItem(slotPacket.c, packetInfo.getPlayer()); // Mask all out-going item
|
||||
// packets
|
||||
}
|
||||
else if (packet instanceof PacketPlayOutWindowItems)
|
||||
@ -490,7 +493,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
|
||||
|
||||
for (int i = 0; i < itemsPacket.b.length; i++)
|
||||
{
|
||||
itemsPacket.b[i] = maskItem(itemsPacket.b[i]); // Mask all
|
||||
itemsPacket.b[i] = maskItem(itemsPacket.b[i], packetInfo.getPlayer()); // Mask all
|
||||
// out-going
|
||||
// item packets
|
||||
ItemStack item = CraftItemStack.asCraftMirror(itemsPacket.b[i]);
|
||||
@ -514,7 +517,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
|
||||
return item;
|
||||
}
|
||||
|
||||
private net.minecraft.server.v1_8_R3.ItemStack maskItem(net.minecraft.server.v1_8_R3.ItemStack item)
|
||||
private net.minecraft.server.v1_8_R3.ItemStack maskItem(net.minecraft.server.v1_8_R3.ItemStack item, Player player)
|
||||
{
|
||||
// Cannot mask a null item
|
||||
if (item == null)
|
||||
@ -533,18 +536,21 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
|
||||
|
||||
List<String> lore = new ArrayList<String>();
|
||||
|
||||
CustomItem ci = parseItem(originalItem);
|
||||
|
||||
for (String line : originalMeta.getLore())
|
||||
{
|
||||
if (!line.startsWith(ITEM_SERIALIZATION_TAG)) // Remove
|
||||
// serialization
|
||||
// lines from
|
||||
// out-going lore
|
||||
if (!line.startsWith(ITEM_SERIALIZATION_TAG))
|
||||
{
|
||||
lore.add(line);
|
||||
}else{
|
||||
}
|
||||
}
|
||||
|
||||
if (ci != null && _legendaryWeights.elements().contains(ci.getClass()))
|
||||
{
|
||||
lore.add(C.cWhite + "Original Owner: " + C.cYellow + (ci.OriginalOwner == null ? "You" : Bukkit.getOfflinePlayer(UUID.fromString(ci.OriginalOwner)).getName()));
|
||||
}
|
||||
|
||||
net.minecraft.server.v1_8_R3.ItemStack newItem = CraftItemStack.asNMSCopy(originalItem);
|
||||
CraftItemStack newCopy = CraftItemStack.asCraftMirror(newItem);
|
||||
ItemMeta newMeta = newCopy.getItemMeta();
|
||||
|
@ -3,17 +3,20 @@ package mineplex.game.clans.items;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import mineplex.game.clans.items.legendaries.LegendaryItem;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.game.clans.items.legendaries.LegendaryItem;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
/**
|
||||
* PlayerGear caches and manages a players set of {@link CustomItem}s that they
|
||||
* currently wield.
|
||||
@ -55,7 +58,17 @@ public class PlayerGear
|
||||
if (item != null && item instanceof LegendaryItem)
|
||||
{
|
||||
LegendaryItem legendary = (LegendaryItem) item;
|
||||
legendary.preUpdate(getPlayer());
|
||||
legendary.update(getPlayer());
|
||||
|
||||
if (legendary.OriginalOwner == null)
|
||||
{
|
||||
legendary.OriginalOwner = getPlayer().getUniqueId().toString();
|
||||
UtilServer.broadcast(F.main("Clans", F.elem(getPlayer().getName()) + " has picked up " + F.vowelAN(legendary.getDisplayName()) + " " + legendary.getDisplayName() + C.mBody + "."));
|
||||
UtilTextMiddle.display(C.cDPurple + "Legendary", F.elem(getPlayer().getName()) + C.cWhite + " picked up " + F.vowelAN(legendary.getDisplayName()) + " " + legendary.getDisplayName() + C.cWhite + ".", 20, 60, 20);
|
||||
|
||||
getPlayer().setItemInHand(legendary.toItemStack());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class GiantsBroadsword extends LegendaryItem
|
||||
|
||||
private void buffPlayer(Player player)
|
||||
{
|
||||
grantPotionEffect(player, PotionEffectType.SLOW, 20, 10);
|
||||
grantPotionEffect(player, PotionEffectType.REGENERATION, 1, 10);
|
||||
grantPotionEffect(player, PotionEffectType.SLOW, 40, 10);
|
||||
grantPotionEffect(player, PotionEffectType.REGENERATION, 40, 10);
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,10 @@ public class LegendaryItem extends CustomItem
|
||||
// Leave implementation to potential subtypes
|
||||
}
|
||||
|
||||
public void preUpdate(Player wielder)
|
||||
{
|
||||
}
|
||||
|
||||
public void onAttack(CustomDamageEvent event, Player wielder)
|
||||
{
|
||||
// Leave implementation to potential subtypes
|
||||
|
@ -74,7 +74,7 @@ public class WindBlade extends LegendaryItem
|
||||
_burnoutThreshold = 0;
|
||||
}
|
||||
|
||||
if (_messageTimer % 20 == 0)
|
||||
if (_messageTimer % 5 == 0)
|
||||
{
|
||||
UtilPlayer.message(wielder, F.main("Wind Blade", "Flight power damaged whilst scraping the ground! Repairs will be finish in " + F.time(UtilTime.MakeStr(burnoutRemaining)) + "."));
|
||||
}
|
||||
|
@ -89,7 +89,6 @@ public abstract class ClansShopPage<T extends ShopBase<ClansManager>> extends Sh
|
||||
addShopItem(index, item, (byte) 0, displayName, 1);
|
||||
}
|
||||
|
||||
|
||||
public void addShopItem(int index, ClansShopItem item)
|
||||
{
|
||||
addShopItem(index, item, (byte) 0);
|
||||
|
@ -54,6 +54,7 @@ public class Spawn extends MiniPlugin
|
||||
public static final int SHOP_RADIUS = 48;
|
||||
public static final String COMBAT_TAG_NAME = "Unsafe";
|
||||
public static final long COMBAT_TAG_DURATION = 15000;
|
||||
public static final Location ORIGIN = new Location(getSpawnWorld(), 0, 0, 0);
|
||||
|
||||
private static Spawn _instance;
|
||||
public static Spawn getInstance() { return _instance; }
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user