diff --git a/Plugins/.idea/compiler.xml b/Plugins/.idea/compiler.xml
index 30263f09d..df8666836 100644
--- a/Plugins/.idea/compiler.xml
+++ b/Plugins/.idea/compiler.xml
@@ -28,7 +28,7 @@
-
+
diff --git a/Plugins/.idea/misc.xml b/Plugins/.idea/misc.xml
index 4b4d0cc04..0f016238b 100644
--- a/Plugins/.idea/misc.xml
+++ b/Plugins/.idea/misc.xml
@@ -16,7 +16,7 @@
-
+
\ No newline at end of file
diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java
index ede793bef..1f2835f13 100644
--- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java
+++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java
@@ -56,11 +56,11 @@ public class MotdManager implements Listener, Runnable
//String motdLine = "§f§l◄ §c§lMaintenance§f§l ►";
//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§l◄ §b§lNew Game§f§l ▬ §3§lChampions CTF§f§l ►";
+ String motdLine = " §f❄ §2§lWinter Update §f❄ §2§lSnow Fight §f❄";
//String motdLine = " §d§lRank Sale §a§l40% Off");
//String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►");
- updateMainMotd(" §f§l§m §8§l§m[ §r §6§lMineplex§r §f§lGames§r §8§l§m ]§f§l§m §r", motdLine);
+ updateMainMotd(" §c§m §f§m §c§m §f§m §2§l§m[ §r §c§lMineplex§r §f§lGames§r §2§l§m ]§f§m §c§m §f§m §c§m §r", motdLine);
System.out.println("Updated Bungee MOTD");
}
}
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/ascii.png b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/ascii.png
new file mode 100644
index 000000000..587966dc3
Binary files /dev/null and b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/ascii.png differ
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java
index da7bc464c..c0a7f5f3b 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java
@@ -552,8 +552,8 @@ public class UtilBlock
if (diagonals)
{
for (int x = -1; x <= 1; x++)
- for (int y = -1; y <= 1; y++)
- for (int z = -1; z <= 1; z++)
+ for (int z = -1; z <= 1; z++)
+ for (int y = 1; y >= -1; y--)
{
if (x == 0 && y == 0 && z == 0) continue;
@@ -563,11 +563,11 @@ public class UtilBlock
else
{
blocks.add(block.getRelative(BlockFace.UP));
- blocks.add(block.getRelative(BlockFace.DOWN));
blocks.add(block.getRelative(BlockFace.NORTH));
blocks.add(block.getRelative(BlockFace.SOUTH));
blocks.add(block.getRelative(BlockFace.EAST));
blocks.add(block.getRelative(BlockFace.WEST));
+ blocks.add(block.getRelative(BlockFace.DOWN));
}
return blocks;
@@ -835,7 +835,7 @@ public class UtilBlock
return getBedHead(bed.getBlock()) != null && getBedFoot(bed.getBlock()) != null;
}
- public static HashSet findConnectedBlocks(Block block, HashSet blocks, int limit)
+ public static HashSet findConnectedBlocks(Block source, Block block, HashSet blocks, int limit, double range)
{
if (blocks == null)
blocks = new HashSet();
@@ -852,10 +852,13 @@ public class UtilBlock
{
if (neighbour.getType() == Material.AIR)
continue;
+
+ if (UtilMath.offset(source.getLocation(), neighbour.getLocation()) > range)
+ continue;
//If neighbour hasn't been searched, recursively search it!
if (!blocks.contains(neighbour))
- findConnectedBlocks(neighbour, blocks, limit);
+ findConnectedBlocks(source, neighbour, blocks, limit, range);
}
return blocks;
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java
index af1712362..f1e17e2df 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java
@@ -1,5 +1,7 @@
package mineplex.core.common.util;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
@@ -509,13 +511,21 @@ public class UtilPlayer
if (cur.isDead())
continue;
+ //Ignore Check
if (ignore != null)
{
- for (int i = 0; i < ignore.length; i++)
+ boolean shouldIgnore = false;
+ for (Entity ent : ignore)
{
- if (cur.equals(ignore[i]))
- continue;
+ if (cur.equals(ent))
+ {
+ shouldIgnore = true;
+ break;
+ }
}
+
+ if (shouldIgnore)
+ continue;
}
double dist = UtilMath.offset(cur.getLocation(), loc);
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java
index c56faa15a..79f248c3d 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java
@@ -1,10 +1,12 @@
package mineplex.core.common.util;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
+import java.util.stream.Stream;
import org.bukkit.Bukkit;
import org.bukkit.Server;
@@ -18,6 +20,11 @@ public class UtilServer
return getServer().getOnlinePlayers().toArray(new Player[0]);
}
+ public static Collection extends Player> getPlayersCollection()
+ {
+ return getServer().getOnlinePlayers();
+ }
+
public static List getSortedPlayers()
{
return getSortedPlayers(new Comparator()
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java
index 8bbac15bc..c5a805558 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java
@@ -1,52 +1,469 @@
package mineplex.core.common.util;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
+
+import javax.imageio.ImageIO;
+
+import mineplex.core.common.CurrencyType;
import org.apache.commons.lang.WordUtils;
-import org.bukkit.Material;
+import org.bukkit.ChatColor;
-public class UtilText {
- public static String listToString(Collection inputList, boolean comma) {
- String out = "";
+public class UtilText
+{
+ private static HashMap _characters = new HashMap();
- for (T cur : inputList) {
- out += cur.toString() + (comma ? ", " : " ");
+ public static enum LineFormat
+ {
+ LORE(200), CHAT(319);
+
+ private int _length;
+
+ private LineFormat(int length)
+ {
+ _length = length;
}
- if (out.length() > 0) {
- out = out.substring(0, out.length() - (comma ? 2 : 1));
+ public int getLength()
+ {
+ return _length;
}
-
- return out;
}
-
- public static int upperCaseCount(String input) {
- int count = 0;
-
- for (int k = 0; k < input.length(); k++) {
-
-
- char ch = input.charAt(k);
- if (Character.isUpperCase(ch))
- count++;
-
+
+ static
+ {
+ try
+ {
+ InputStream inputStream = CurrencyType.class.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();
}
-
- return count;
}
- public static int lowerCaseCount(String input) {
- int count = 0;
-
- for (int k = 0; k < input.length(); k++) {
-
-
- char ch = input.charAt(k);
- if (Character.isLowerCase(ch))
- count++;
-
+
+ public static String center(String string, LineFormat lineFormat)
+ {
+ int length = getLength(string);
+
+ if (length > lineFormat.getLength())
+ {
+ return string;
}
-
- return count;
+
+ // Get the number of empty pixels on both sides of the string
+ int div = (int) Math.floor((lineFormat.getLength() - length) / 2D);
+
+ div -= 2; // For the gap between the strings
+
+ return fillLine(" ", div) + string + fillLine(" ", div);
+ }
+
+ public static String alignRight(String string, LineFormat lineFormat)
+ {
+ int length = getLength(string);
+
+ if (length > lineFormat.getLength())
+ {
+ return string;
+ }
+
+ // Get the number of empty pixels on both sides of the string
+ int div = lineFormat.getLength() - length;
+
+ div -= 1; // For the gap between the strings
+
+ return fillLine(" ", div) + string;
+ }
+
+ public static String centerChat(String string, LineFormat lineFormat)
+ {
+ int length = getLength(string);
+
+ if (length > lineFormat.getLength())
+ {
+ return string;
+ }
+
+ // Get the number of empty pixels on both sides of the string
+ int div = (int) Math.floor(((lineFormat.getLength() + 10) - length) / 2D);
+
+ div -= 2; // For the gap between the strings
+
+ return fillLine(" ", div) + string;
+ }
+
+ public static String substringPixels(String string, int cutoff)
+ {
+ int len = 0;
+
+ char[] array = string.toCharArray();
+ boolean bold = false;
+
+ for (int i = 0; i < array.length; i++)
+ {
+ char c = array[i];
+
+ if (c == '�')
+ {
+ if (++i < array.length)
+ {
+ ChatColor color = ChatColor.getByChar(array[i]);
+
+ if (color != null)
+ {
+ if (color.equals(ChatColor.BOLD))
+ {
+ bold = true;
+ }
+ else if (color.equals(ChatColor.RESET) || color.isColor())
+ {
+ bold = false;
+ }
+ }
+ }
+
+ continue;
+ }
+
+ if (!_characters.containsKey(c))
+ {
+ continue;
+ }
+
+ int toAdd = _characters.get(c);
+
+ if (bold)
+ {
+ toAdd++;
+ }
+
+ if (len + toAdd > cutoff)
+ {
+ return string.substring(0, Math.max(0, i - 1));
+ }
+
+ if (i + 1 < array.length)
+ {
+ len++;
+ }
+ }
+
+ return string;
+ }
+
+ public static ArrayList splitLines(String[] strings, LineFormat lineFormat)
+ {
+ ArrayList lines = new ArrayList();
+
+ for (String s : strings)
+ {
+ lines.addAll(splitLine(s, lineFormat));
+ }
+
+ return lines;
+ }
+
+ public static ArrayList splitLine(String string, LineFormat lineFormat)
+ {
+ ArrayList strings = new ArrayList();
+ String current = "";
+ int currentLength = 0;
+ String[] split = string.split(" ");
+ String colors = "";
+
+ for (int i = 0; i < split.length; i++)
+ {
+ String word = split[i];
+ int wordLength = getLength(colors + word);
+
+ if (currentLength + wordLength + 4 > lineFormat.getLength() && !current.isEmpty())
+ {
+ strings.add(current);
+ current = colors + word;
+ currentLength = wordLength + 1;
+ continue;
+ }
+
+ if (i != 0)
+ {
+ current += " ";
+ currentLength += 4;
+ }
+
+ current += word;
+ currentLength += wordLength;
+ colors = ChatColor.getLastColors(current);
+ }
+
+ if (!current.isEmpty())
+ {
+ strings.add(current);
+ }
+
+ return strings;
+ }
+
+ public static String fillLine(String filler, int maxPixels)
+ {
+ int pixels = getLength(filler);
+
+ if (pixels <= 0)
+ {
+ return "";
+ }
+
+ String toReturn = "";
+ int currentLen = 0;
+
+ int offset = maxPixels % 4;
+ boolean isOffset = false;
+
+ if (offset > 0)
+ {
+ toReturn += C.Bold;
+ }
+
+ while (currentLen + pixels <= maxPixels)
+ {
+ currentLen += pixels + 1;
+ toReturn += filler;
+
+ if (offset-- > 0)
+ {
+ currentLen++;
+
+ if (offset == 0)
+ {
+ isOffset = false;
+ toReturn += ChatColor.RESET;
+ }
+ }
+ }
+
+ if (isOffset)
+ {
+ toReturn += ChatColor.RESET;
+ }
+
+ return toReturn;
+ }
+
+ public static boolean fitsOneLine(String string, LineFormat lineFormat)
+ {
+ return getLength(string) <= lineFormat.getLength();
+ }
+
+ public static int getLength(String string)
+ {
+ int len = 0;
+
+ char[] array = string.toCharArray();
+ boolean bold = false;
+
+ for (int i = 0; i < array.length; i++)
+ {
+ char c = array[i];
+
+ if (c == '�')
+ {
+ if (++i < array.length)
+ {
+ ChatColor color = ChatColor.getByChar(array[i]);
+
+ if (color != null)
+ {
+ if (color.equals(ChatColor.BOLD))
+ {
+ bold = true;
+ }
+ else if (color.equals(ChatColor.RESET) || color.isColor())
+ {
+ bold = false;
+ }
+ }
+ }
+
+ continue;
+ }
+
+ if (!_characters.containsKey(c))
+ {
+ continue;
+ }
+
+ len += _characters.get(c);
+
+ if (bold)
+ {
+ len++;
+ }
+
+ if (i + 1 < array.length)
+ {
+ len++;
+ }
+ }
+
+ return len;
+ }
+
+ private static void grab(Character character, BufferedImage image, int imageX, int imageY)
+ {
+ if (character == ' ')
+ {
+ _characters.put(character, 3);
+ return;
+ }
+
+ for (int x = 0; x < 8; x++)
+ {
+ boolean isTransparentLine = true;
+
+ for (int y = 0; y < 8; y++)
+ {
+ int pixel = image.getRGB(imageX + x, imageY + y);
+
+ if ((pixel >> 24) != 0x00)
+ {
+ isTransparentLine = false;
+ break;
+ }
+ }
+
+ if (isTransparentLine)
+ {
+ _characters.put(character, x);
+ return;
+ }
+ }
+
+ _characters.put(character, 8);
}
public static boolean isStringSimilar(String newString, String oldString, float matchRequirement)
@@ -55,59 +472,136 @@ public class UtilText {
{
return newString.toLowerCase().equals(oldString.toLowerCase());
}
-
- for (int i=0 ; i < newString.length() * matchRequirement ; i++)
+
+ for (int i = 0; i < newString.length() * matchRequirement; i++)
{
int matchFromIndex = 0;
-
- //Look for substrings starting at i
- for (int j=0 ; j < oldString.length() ; j++)
+
+ // Look for substrings starting at i
+ for (int j = 0; j < oldString.length(); j++)
{
- //End of newString
- if (i+j >= newString.length())
+ // End of newString
+ if (i + j >= newString.length())
{
break;
}
-
- //Matched
- if (newString.charAt(i+j) == oldString.charAt(j))
+
+ // Matched
+ if (newString.charAt(i + j) == oldString.charAt(j))
{
matchFromIndex++;
-
+
if (matchFromIndex >= newString.length() * matchRequirement)
return true;
}
- //No Match > Reset
+ // No Match > Reset
else
{
break;
}
}
}
-
+
return false;
}
-
+
+ public static String listToString(Collection inputList, boolean comma)
+ {
+ String out = "";
+
+ for (T cur : inputList)
+ {
+ out += cur.toString() + (comma ? ", " : " ");
+ }
+
+ if (out.length() > 0)
+ {
+ out = out.substring(0, out.length() - (comma ? 2 : 1));
+ }
+
+ return out;
+ }
+
+ public static int lowerCaseCount(String input)
+ {
+ int count = 0;
+
+ for (int k = 0; k < input.length(); k++)
+ {
+
+ char ch = input.charAt(k);
+ if (Character.isLowerCase(ch))
+ count++;
+
+ }
+
+ return count;
+ }
+
+ public static int upperCaseCount(String input)
+ {
+ int count = 0;
+
+ for (int k = 0; k < input.length(); k++)
+ {
+
+ char ch = input.charAt(k);
+ if (Character.isUpperCase(ch))
+ count++;
+
+ }
+
+ return count;
+ }
+
public static String[] wrap(String text, int lineLength)
{
return wrap(text, lineLength, true);
}
-
- public static String[] wrap(String text, int lineLength, boolean wrapLongerWords) {
+
+ public static String[] wrap(String text, int lineLength, boolean wrapLongerWords)
+ {
return WordUtils.wrap(text, lineLength, "\00D0", wrapLongerWords).split("\00D0");
}
-
+
public static String repeat(String txt, int times)
{
return new String(new byte[times]).replace("\0", txt);
}
-
- public static boolean plural(int x){
+
+ public static boolean plural(int x)
+ {
return x <= 0 ? true : x > 1;
}
- public static String trim(int maxLength, String s) {
+ public static String trim(int maxLength, String s)
+ {
return s.length() <= maxLength ? s : s.substring(0, maxLength);
}
-}
+ public static String arrayToString(X[] array, String delimiter)
+ {
+ StringBuilder string = new StringBuilder();
+
+ int index = 0;
+ for (X x : array)
+ {
+ string.append(x.toString());
+
+ if (index != array.length - 1)
+ {
+ string.append(delimiter);
+ }
+
+ index++;
+ }
+
+ return string.toString();
+ }
+
+ public static String arrayToString(X[] array)
+ {
+ return arrayToString(array, null);
+ }
+
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java b/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java
index 12bc7d776..47c37044a 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java
@@ -5,6 +5,7 @@ import java.util.HashSet;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
+import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@@ -18,6 +19,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
+import net.minecraft.server.v1_8_R3.MinecraftServer;
public class LagMeter extends MiniPlugin
{
@@ -128,9 +130,27 @@ public class LagMeter extends MiniPlugin
sendUpdate(player);
}
}
+
+ private String getPrefix(double value)
+ {
+ if (value >= 18.0)
+ return C.cGreen;
+ else if (value >= 15)
+ return C.cYellow;
+ else
+ return C.cRed;
+ }
private void sendUpdate(Player player)
{
+ double[] tps = MinecraftServer.getServer().recentTps;
+ String mcString = "";
+ for (int i = 0; i < tps.length; i++)
+ {
+ mcString += getPrefix(tps[i]) + (double)Math.round(tps[i] * 100.0D) / 100.0D;
+ if (i < tps.length - 1) mcString += C.cWhite + ", ";
+ }
+
player.sendMessage(" ");
player.sendMessage(" ");
player.sendMessage(" ");
@@ -138,6 +158,8 @@ public class LagMeter extends MiniPlugin
player.sendMessage(" ");
player.sendMessage(F.main(getName(), ChatColor.GRAY + "Live-------" + ChatColor.YELLOW + String.format("%.00f", _ticksPerSecond)));
player.sendMessage(F.main(getName(), ChatColor.GRAY + "Avg--------" + ChatColor.YELLOW + String.format("%.00f", _ticksPerSecondAverage * 20)));
+ player.sendMessage(F.main(getName(), ChatColor.YELLOW + "MC Timings (5,10,15 min avg)"));
+ player.sendMessage(F.main(getName(), ChatColor.GRAY + mcString));
player.sendMessage(F.main(getName(), ChatColor.YELLOW + "MEM"));
player.sendMessage(F.main(getName(), ChatColor.GRAY + "Free-------" + ChatColor.YELLOW + (Runtime.getRuntime().freeMemory() / 1048576) + "MB"));
player.sendMessage(F.main(getName(), ChatColor.GRAY + "Max--------" + ChatColor.YELLOW + (Runtime.getRuntime().maxMemory() / 1048576)) + "MB");
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java
index 3abbf00e0..f5aa7f809 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java
@@ -75,7 +75,7 @@ public class MountCart extends Mount>
if (event.getRightClicked() == null)
return;
- SingleEntityMountData mount = GetActive().get(event.getPlayer());
+ SingleEntityMountData mount = getMountData(event.getRightClicked());
if(mount == null) return;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java
index 2a0b3831a..e8a1bd649 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java
@@ -30,11 +30,11 @@ public class MountSlime extends Mount>
{
super(manager, "Slime Mount", Material.SLIME_BALL, (byte)0, new String[]
{
- ChatColor.RESET + "Bounce around on your very",
- ChatColor.RESET + "own personal slime friend!",
+ ChatColor.RESET + "Bounce around on your very",
+ ChatColor.RESET + "own personal slime friend!",
},
15000);
-
+
KnownPackage = false;
}
@@ -42,153 +42,155 @@ public class MountSlime extends Mount>
{
player.leaveVehicle();
player.eject();
-
+
//Remove other mounts
Manager.DeregisterAll(player);
-
+
SingleEntityMountData mount = new SingleEntityMountData(player, player.getWorld().spawn(player.getLocation(), Slime.class));
mount.getEntity().setSize(2);
-
+
mount.getEntity().setCustomName(player.getName() + "'s " + GetName());
//Inform
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
-
+
//Store
_active.put(player, mount);
}
-
+
public void Disable(Player player)
{
SingleEntityMountData mount = _active.remove(player);
if (mount != null)
{
mount.remove();
-
+
//Inform
UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + "."));
-
+
Manager.removeActive(player);
}
}
-
+
@EventHandler
public void interactMount(PlayerInteractEntityEvent event)
{
if (event.getRightClicked() == null)
return;
-
- if (!GetActive().containsKey(event.getPlayer()))
- return;
-
- if(!GetActive().get(event.getPlayer()).ownsMount(event.getPlayer()))
- return;
-
+
+ SingleEntityMountData data = GetActive().get(event.getPlayer());
+
+ if(data == null) return;
+
+ if(!data.ownsMount(event.getPlayer())) return;
+
+ if(!data.isPartOfMount(event.getRightClicked())) return;
+
event.getPlayer().leaveVehicle();
event.getPlayer().eject();
-
+
event.getRightClicked().setPassenger(event.getPlayer());
}
-
+
@EventHandler
public void target(EntityTargetEvent event)
{
if (!GetActive().containsKey(event.getTarget()))
return;
-
+
if (!GetActive().get(event.getTarget()).equals(event.getEntity()))
event.setCancelled(true);
}
-
+
@EventHandler
public void updateBounce(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
-
+
//Bounce
for (SingleEntityMountData slimeData : GetActive().values())
{
Slime slime = slimeData.getEntity();
-
+
if (slime.getPassenger() == null)
{
UtilEnt.setFakeHead(slime, false);
continue;
}
-
+
if (!UtilEnt.isGrounded(slime))
continue;
-
+
if (!(slime.getPassenger() instanceof Player))
continue;
-
+
Player player = (Player)slime.getPassenger();
-
+
if (!Recharge.Instance.use(player, GetName(), 200, false, false))
continue;
Vector dir = slime.getPassenger().getLocation().getDirection();
-
+
UtilAction.velocity(slime, dir, 1, true, 0, 0.4, 1, true);
-
+
UtilEnt.CreatureForceLook(slime, 0, UtilAlg.GetYaw(dir));
-
+
slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_WALK, 1f, 0.75f);
}
-
+
//Collide
for (SingleEntityMountData slimeData : GetActive().values())
{
Slime slime = slimeData.getEntity();
if (slime.getPassenger() == null)
continue;
-
+
if (!(slime.getPassenger() instanceof Player))
continue;
-
+
Player player = (Player)slime.getPassenger();
-
+
if (!Recharge.Instance.usable(player, GetName() + " Collide"))
continue;
-
+
for (SingleEntityMountData otherSlime : GetActive().values())
{
Slime other = otherSlime.getEntity();
-
+
if (other.equals(slime))
continue;
-
+
if (other.getPassenger() == null)
continue;
-
+
if (!(other.getPassenger() instanceof Player))
continue;
-
+
Player otherPlayer = (Player)other.getPassenger();
-
+
if (!Recharge.Instance.usable(otherPlayer, GetName() + " Collide"))
continue;
-
+
//Collide
if (UtilMath.offset(slime, other) > 2)
continue;
-
+
Recharge.Instance.useForce(player, GetName() + " Collide", 500);
Recharge.Instance.useForce(otherPlayer, GetName() + " Collide", 500);
-
+
UtilAction.velocity(slime, UtilAlg.getTrajectory(other, slime), 1.2, false, 0, 0.8, 10, true);
UtilAction.velocity(other, UtilAlg.getTrajectory(slime, other), 1.2, false, 0, 0.8, 10, true);
-
+
slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_ATTACK, 1f, 0.5f);
slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_WALK, 1f, 0.5f);
other.getWorld().playSound(other.getLocation(), Sound.SLIME_WALK, 1f, 0.5f);
-
+
slime.playEffect(EntityEffect.HURT);
other.playEffect(EntityEffect.HURT);
}
}
}
-
-
+
+
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/INoteVerifier.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/INoteVerifier.java
new file mode 100644
index 000000000..f423c6394
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/INoteVerifier.java
@@ -0,0 +1,10 @@
+package mineplex.core.noteblock;
+
+import org.bukkit.entity.Player;
+
+public interface INoteVerifier
+{
+
+ public boolean shouldPlay(Player player);
+
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NBSReader.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NBSReader.java
new file mode 100644
index 000000000..e7844c9d1
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NBSReader.java
@@ -0,0 +1,134 @@
+package mineplex.core.noteblock;
+
+import java.io.DataInputStream;
+import java.io.EOFException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.HashMap;
+
+/**
+ * Information about the NBS Format was taken from
+ * http://www.stuffbydavid.com/mcnbs/format
+ */
+public class NBSReader
+{
+ public static NoteSong loadSong(String fileName) throws FileNotFoundException
+ {
+ return loadSong(new DataInputStream(new FileInputStream(new File(fileName))), fileName);
+ }
+
+ public static NoteSong loadSong(DataInputStream stream, String defaultName)
+ {
+ try
+ {
+ // Header Information
+ short length = readShort(stream);
+ short height = readShort(stream);
+ String name = readString(stream);
+ String author = readString(stream);
+ String originalAuthor = readString(stream);
+ String description = readString(stream);
+ short tempo = readShort(stream); // Tempo multiplied by 1000
+ boolean autosave = stream.readBoolean();
+ byte autosaveDuration = stream.readByte();
+ byte timeSignature = stream.readByte();
+ int minutesSpent = readInt(stream);
+ int leftClicks = readInt(stream);
+ int rightClicks = readInt(stream);
+ int blocksAdded = readInt(stream);
+ int blocksRemoved = readInt(stream);
+ String midiFileName = readString(stream);
+
+ if ((name == null || name.length() == 0) && defaultName != null)
+ name = defaultName;
+
+ HashMap layerMap = new HashMap();
+
+ // Note Block Information
+ int tick = -1;
+ int jumps = 0;
+ while (true)
+ {
+ jumps = readShort(stream);
+ if (jumps == 0)
+ break;
+ tick += jumps;
+ int layer = -1;
+ while (true)
+ {
+ jumps = readShort(stream);
+ if (jumps == 0)
+ break;
+ layer += jumps;
+ byte instrument = stream.readByte();
+ byte key = stream.readByte();
+
+ Note note = new Note(instrument, key);
+ NoteLayer noteLayer = layerMap.get(layer);
+ if (noteLayer == null)
+ {
+ noteLayer = new NoteLayer();
+ layerMap.put(layer, noteLayer);
+ }
+ noteLayer.setNote(tick, note);
+ }
+ }
+
+ // Layer Information
+ for (int i = 0; i < height; i++)
+ {
+ NoteLayer layer = layerMap.get(i);
+ if (layer != null)
+ {
+ layer.setName(readString(stream));
+ layer.setVolume(stream.readByte());
+ }
+ }
+
+ System.out.println("[NBSReader] Successfully loaded song " + name + "");
+ System.out.println("Tempo: " + tempo);
+ return new NoteSong(length, height, name, tempo, timeSignature, layerMap);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ private static int readInt(DataInputStream stream) throws IOException
+ {
+ // For some reason the bytes are in reverse order from stream.readInt()
+ int ch1 = stream.read();
+ int ch2 = stream.read();
+ int ch3 = stream.read();
+ int ch4 = stream.read();
+ if ((ch1 | ch2 | ch3 | ch4) < 0)
+ throw new EOFException();
+ return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + ch1);
+ }
+
+ private static short readShort(DataInputStream stream) throws IOException
+ {
+ // For some reason the bytes are in reverse order from stream.readShort()
+ int ch1 = stream.read();
+ int ch2 = stream.read();
+ if ((ch1 | ch2) < 0)
+ throw new EOFException();
+ return (short)((ch2 << 8) + ch1);
+ }
+
+ private static String readString(DataInputStream stream) throws IOException
+ {
+ int length = readInt(stream);
+ char[] string = new char[length];
+ for (int i = 0; i < length; i++)
+ {
+ string[i] = (char) stream.readByte();
+ }
+ return new String(string);
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/Note.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/Note.java
new file mode 100644
index 000000000..223d56011
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/Note.java
@@ -0,0 +1,26 @@
+package mineplex.core.noteblock;
+
+/**
+ * Represents a single note to be played
+ */
+public class Note
+{
+ private byte _instrument;
+ private byte _note;
+
+ public Note(byte instrument, byte note)
+ {
+ _instrument = instrument;
+ _note = note;
+ }
+
+ public byte getInstrument()
+ {
+ return _instrument;
+ }
+
+ public byte getNote()
+ {
+ return _note;
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NoteLayer.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NoteLayer.java
new file mode 100644
index 000000000..6c83bbab1
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NoteLayer.java
@@ -0,0 +1,50 @@
+package mineplex.core.noteblock;
+
+import java.util.HashMap;
+
+/**
+ * Represents a layer of notes in Note Block Studio
+ */
+public class NoteLayer
+{
+ private HashMap _noteMap; // Notes indexed by ticks
+ private int _volume; // Volume as a percentage 1-100
+ private String _name;
+
+ public NoteLayer()
+ {
+ _noteMap = new HashMap();
+ _volume = 100;
+ _name = "";
+ }
+
+ public int getVolume()
+ {
+ return _volume;
+ }
+
+ public void setVolume(int volume)
+ {
+ _volume = volume;
+ }
+
+ public String getName()
+ {
+ return _name;
+ }
+
+ public void setName(String name)
+ {
+ _name = name;
+ }
+
+ public void setNote(int ticks, Note note)
+ {
+ _noteMap.put(ticks, note);
+ }
+
+ public Note getNote(int ticks)
+ {
+ return _noteMap.get(ticks);
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java
new file mode 100644
index 000000000..941bc1dd9
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java
@@ -0,0 +1,122 @@
+package mineplex.core.noteblock;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import mineplex.core.common.util.UtilServer;
+import mineplex.core.noteblock.event.SongFinishEvent;
+import mineplex.core.noteblock.event.SongStartEvent;
+
+public class NotePlayer
+{
+ private final JavaPlugin _plugin;
+ private final NoteSong _song;
+ private final INoteVerifier _verifier;
+ private final long _sleepMs;
+ private volatile float _volumeMult;
+ private volatile boolean _loop;
+ private volatile int _tick;
+ private volatile boolean _finished;
+
+ public NotePlayer(JavaPlugin plugin, NoteSong song, INoteVerifier verifier, float volumeMult, boolean loop)
+ {
+ _plugin = plugin;
+ _song = song;
+ _verifier = verifier;
+ _sleepMs = (long) (1000 / (song.getTempo() / 100D));
+ _loop = loop;
+ _tick = 0;
+ _volumeMult = volumeMult;
+ _finished = false;
+
+ startThread();
+
+ SongStartEvent event = new SongStartEvent(_song);
+ _plugin.getServer().getPluginManager().callEvent(event);
+ }
+
+ private void startThread()
+ {
+ Thread thread = new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ long startTime = System.currentTimeMillis();
+ while (!_finished)
+ {
+ _tick++;
+ if (_tick > _song.getLength())
+ {
+ if (_loop)
+ {
+ _tick = 1;
+ }
+ else
+ {
+ _finished = true;
+
+ _plugin.getServer().getScheduler().runTask(_plugin, new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ SongFinishEvent event = new SongFinishEvent(_song);
+ _plugin.getServer().getPluginManager().callEvent(event);
+ }
+ });
+
+ return;
+ }
+ }
+
+ playTick(_tick);
+
+ try
+ {
+ Thread.sleep(_sleepMs);
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ });
+
+ thread.start();
+ }
+
+ private void playTick(int tick)
+ {
+ Player[] playerArray = UtilServer.getPlayers();
+ List players = new ArrayList<>(playerArray.length);
+ for (Player player : playerArray)
+ {
+ if (_verifier.shouldPlay(player))
+ players.add(player);
+ }
+
+ for (NoteLayer layer : _song.getLayers())
+ {
+ Note note = layer.getNote(tick);
+ if (note != null)
+ {
+ float volume = _volumeMult * (layer.getVolume() / 100F);
+ for (Player player : players)
+ {
+ player.playSound(player.getEyeLocation(), UtilNote.getInstrumentSound(note.getInstrument()), volume, (float) UtilNote.getPitch(note.getNote() - 33));
+ }
+ }
+ }
+ }
+
+ public void cancel()
+ {
+ _finished = true;
+ }
+
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NoteSong.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NoteSong.java
new file mode 100644
index 000000000..ee892552b
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NoteSong.java
@@ -0,0 +1,57 @@
+package mineplex.core.noteblock;
+
+import java.util.Collection;
+import java.util.HashMap;
+
+public class NoteSong
+{
+ // Song Data
+ private short _length;
+ private short _height;
+ private String _name;
+ private short _tempo;
+ private byte _timeSignature;
+
+ // Layer Data
+ private HashMap _layerMap;
+
+ public NoteSong(short length, short height, String name, short tempo, byte timeSignature, HashMap layerMap)
+ {
+ _length = length;
+ _height = height;
+ _name = name;
+ _tempo = tempo;
+ _timeSignature = timeSignature;
+ _layerMap = layerMap;
+ }
+
+ public short getLength()
+ {
+ return _length;
+ }
+
+ public short getHeight()
+ {
+ return _height;
+ }
+
+ public String getName()
+ {
+ return _name;
+ }
+
+ public short getTempo()
+ {
+ return _tempo;
+ }
+
+ public byte getTimeSignature()
+ {
+ return _timeSignature;
+ }
+
+ public Collection getLayers()
+ {
+ return _layerMap.values();
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/UtilNote.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/UtilNote.java
new file mode 100644
index 000000000..4ac15643e
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/UtilNote.java
@@ -0,0 +1,42 @@
+package mineplex.core.noteblock;
+
+import org.bukkit.Sound;
+
+/**
+ * See http://minecraft.gamepedia.com/Note_Block for information about pitches
+ */
+public class UtilNote
+{
+ private static final double[] PITCH = { 0.5, 0.53, 0.56, 0.6, 0.63, 0.67, 0.7, 0.76, 0.8, 0.84, 0.9, 0.94, 1.0,
+ 1.06, 1.12, 1.18, 1.26, 1.34, 1.42, 1.5, 1.6, 1.68, 1.78, 1.88, 2.0 };
+
+ public static Sound getInstrumentSound(byte instrument)
+ {
+ switch (instrument)
+ {
+ case 0:
+ return Sound.NOTE_PIANO;
+ case 1:
+ return Sound.NOTE_BASS_GUITAR;
+ case 2:
+ return Sound.NOTE_BASS_DRUM;
+ case 3:
+ return Sound.NOTE_SNARE_DRUM;
+ case 4:
+ return Sound.NOTE_STICKS;
+ default:
+ return Sound.NOTE_PIANO;
+ }
+ }
+
+ public static double getPitch(int note)
+ {
+ if (note >= 0 && note < PITCH.length)
+ {
+ return PITCH[note];
+ }
+
+ return 0.0;
+ }
+
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/event/SongFinishEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/event/SongFinishEvent.java
new file mode 100644
index 000000000..863537903
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/event/SongFinishEvent.java
@@ -0,0 +1,25 @@
+package mineplex.core.noteblock.event;
+
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+import mineplex.core.noteblock.NoteSong;
+
+public class SongFinishEvent extends Event
+{
+ private static final HandlerList handlers = new HandlerList();
+ public static HandlerList getHandlerList() { return handlers; }
+ public HandlerList getHandlers() { return handlers; }
+
+ private NoteSong _song;
+
+ public SongFinishEvent(NoteSong song)
+ {
+ _song = song;
+ }
+
+ public NoteSong getSong()
+ {
+ return _song;
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/event/SongStartEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/event/SongStartEvent.java
new file mode 100644
index 000000000..00993f7c8
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/event/SongStartEvent.java
@@ -0,0 +1,25 @@
+package mineplex.core.noteblock.event;
+
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+import mineplex.core.noteblock.NoteSong;
+
+public class SongStartEvent extends Event
+{
+ private static final HandlerList handlers = new HandlerList();
+ public static HandlerList getHandlerList() { return handlers; }
+ public HandlerList getHandlers() { return handlers; }
+
+ private NoteSong _song;
+
+ public SongStartEvent(NoteSong song)
+ {
+ _song = song;
+ }
+
+ public NoteSong getSong()
+ {
+ return _song;
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java
index 53c841b6c..8e4cb3dc7 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java
@@ -1,5 +1,6 @@
package mineplex.core.notifier;
+import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -12,14 +13,16 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
+import mineplex.core.preferences.PreferencesManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class NotificationManager extends MiniPlugin
{
- private boolean _enabled = false;
+ private boolean _enabled = true;
private CoreClientManager _clientManager;
+ private PreferencesManager _preferencesManager;
private String _summerLine =
C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" +
@@ -29,11 +32,12 @@ public class NotificationManager extends MiniPlugin
C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" +
C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█";
- public NotificationManager(JavaPlugin plugin, CoreClientManager client)
+ public NotificationManager(JavaPlugin plugin, CoreClientManager client, PreferencesManager preferencesManager)
{
super("Notification Manager", plugin);
_clientManager = client;
+ _preferencesManager = preferencesManager;
}
@EventHandler
@@ -48,8 +52,25 @@ public class NotificationManager extends MiniPlugin
// if (event.getType() == UpdateType.MIN_16)
// sale();
+ if (event.getType() == UpdateType.MIN_08)
+ christmasSale();
}
+ private void christmasSale()
+ {
+ for (Player player : UtilServer.getPlayers())
+ {
+ if (!_preferencesManager.Get(player).DisableAds)
+ {
+ player.sendMessage(C.cWhite + " ");
+ player.sendMessage(C.cRedB + " MASSIVE WINTER SALE");
+ player.sendMessage(C.cWhiteB + " 50% OFF ALL RANKS");
+ player.sendMessage(" " + C.cGreen + C.Line + "www.mineplex.com/shop");
+ player.sendMessage(C.cWhite + " ");
+ }
+ }
+ }
+
private void sale()
{
for (Player player : UtilServer.getPlayers())
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/playerCount/PlayerCountManager.java b/Plugins/Mineplex.Core/src/mineplex/core/playerCount/PlayerCountManager.java
new file mode 100644
index 000000000..c73f87d00
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/playerCount/PlayerCountManager.java
@@ -0,0 +1,73 @@
+package mineplex.core.playerCount;
+
+import org.bukkit.event.EventHandler;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import mineplex.core.MiniPlugin;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import mineplex.serverdata.Region;
+import mineplex.serverdata.data.BungeeServer;
+import mineplex.serverdata.data.DataRepository;
+import mineplex.serverdata.redis.RedisDataRepository;
+import mineplex.serverdata.servers.ConnectionData;
+import mineplex.serverdata.servers.ServerManager;
+
+public class PlayerCountManager extends MiniPlugin
+{
+ private Region _region;
+ private DataRepository _repository;
+ private DataRepository _secondRepository;
+
+ private volatile int _playerCount;
+
+ public PlayerCountManager(JavaPlugin plugin)
+ {
+ super("PlayerCount", plugin);
+
+ _region = plugin.getConfig().getBoolean("serverstatus.us") ? Region.US : Region.EU;
+
+ _repository = new RedisDataRepository(ServerManager.getConnection(true, ServerManager.SERVER_STATUS_LABEL), ServerManager.getConnection(false, ServerManager.SERVER_STATUS_LABEL),
+ Region.ALL, BungeeServer.class, "bungeeServers");
+
+ if (_region == Region.US)
+ _secondRepository = new RedisDataRepository(new ConnectionData("10.81.1.156", 6379, ConnectionData.ConnectionType.MASTER, "ServerStatus"), new ConnectionData("10.81.1.156", 6377, ConnectionData.ConnectionType.SLAVE, "ServerStatus"),
+ Region.ALL, BungeeServer.class, "bungeeServers");
+ else
+ _secondRepository = new RedisDataRepository(new ConnectionData("10.33.53.16", 6379, ConnectionData.ConnectionType.MASTER, "ServerStatus"), new ConnectionData("10.33.53.16", 6377, ConnectionData.ConnectionType.SLAVE, "ServerStatus"),
+ Region.ALL, BungeeServer.class, "bungeeServers");
+
+ updatePlayerCount();
+ }
+
+ private void updatePlayerCount()
+ {
+ int totalPlayers = 0;
+ for (BungeeServer server : _repository.getElements())
+ {
+ totalPlayers += server.getPlayerCount();
+ }
+
+ for (BungeeServer server : _secondRepository.getElements())
+ {
+ totalPlayers += server.getPlayerCount();
+ }
+
+ _playerCount = totalPlayers;
+ }
+
+ public int getPlayerCount()
+ {
+ return _playerCount;
+ }
+
+ @EventHandler
+ public void refresh(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.SEC)
+ return;
+
+ runAsync(this::updatePlayerCount);
+ }
+
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java
index b4ac74e62..ef2a4da64 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java
@@ -84,19 +84,6 @@ public class ServerCommand extends CommandBase
else
deniedAccess = true;
}
- else if (servUp.contains("CLANS-"))
- {
- if (playerRank.has(Rank.MODERATOR))
- {
- Plugin.sendPlayerToServer(player, args[0]);
- }
- else
- {
- UtilPlayer.message(player,
- F.main(Plugin.getName(), C.cRed + "You must join clans through the hub! Join " + C.cGold + "ClansHub-1"
- + C.cRed + "!"));
- }
- }
else
{
Plugin.sendPlayerToServer(player, args[0]);
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java
index 82eec02d1..ae7f67755 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java
@@ -136,6 +136,6 @@ public class PreferencesManager extends MiniDbClientPlugin
@Override
public String getQuery(int accountId, String uuid, String name)
{
- return "SELECT games, visibility, showChat, friendChat, privateMessaging, partyRequests, invisibility, forcefield, showMacReports, ignoreVelocity, pendingFriendRequests, friendDisplayInventoryUI, clanTips FROM accountPreferences WHERE accountPreferences.uuid = '" + uuid + "' LIMIT 1;";
+ return "SELECT games, visibility, showChat, friendChat, privateMessaging, partyRequests, invisibility, forcefield, showMacReports, ignoreVelocity, pendingFriendRequests, friendDisplayInventoryUI, clanTips, hubMusic, disableAds FROM accountPreferences WHERE accountPreferences.uuid = '" + uuid + "' LIMIT 1;";
}
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java
index 7449c83c9..957785cb4 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java
@@ -24,7 +24,7 @@ public class PreferencesRepository extends RepositoryBase
// DEFAULT 0, showMacReports BOOL NOT NULL DEFAULT 0, ignoreVelocity BOOL
// NOT NULL DEFAULT 0, PRIMARY KEY (id), UNIQUE INDEX uuid_index (uuid));";
private static String INSERT_ACCOUNT = "INSERT INTO accountPreferences (uuid) VALUES (?) ON DUPLICATE KEY UPDATE uuid=uuid;";
- private static String UPDATE_ACCOUNT_PREFERENCES = "UPDATE accountPreferences SET games = ?, visibility = ?, showChat = ?, friendChat = ?, privateMessaging = ?, partyRequests = ?, invisibility = ?, forcefield = ?, showMacReports = ?, ignoreVelocity = ?, pendingFriendRequests = ?, friendDisplayInventoryUI = ?, clanTips = ? WHERE uuid=?;";
+ private static String UPDATE_ACCOUNT_PREFERENCES = "UPDATE accountPreferences SET games = ?, visibility = ?, showChat = ?, friendChat = ?, privateMessaging = ?, partyRequests = ?, invisibility = ?, forcefield = ?, showMacReports = ?, ignoreVelocity = ?, pendingFriendRequests = ?, friendDisplayInventoryUI = ?, clanTips = ?, hubMusic = ?, disableAds = ? WHERE uuid=?;";
public PreferencesRepository(JavaPlugin plugin)
{
@@ -61,8 +61,10 @@ public class PreferencesRepository extends RepositoryBase
preparedStatement.setBoolean(11, entry.getValue().PendingFriendRequests);
preparedStatement.setBoolean(12, entry.getValue().friendDisplayInventoryUI);
preparedStatement.setBoolean(13, entry.getValue().ClanTips);
+ preparedStatement.setBoolean(14, entry.getValue().HubMusic);
+ preparedStatement.setBoolean(15, entry.getValue().DisableAds);
System.out.println(">> " + entry.getValue().ClanTips);
- preparedStatement.setString(14, entry.getKey());
+ preparedStatement.setString(16, entry.getKey());
preparedStatement.addBatch();
}
@@ -89,8 +91,10 @@ public class PreferencesRepository extends RepositoryBase
preparedStatement.setBoolean(11, entry.getValue().PendingFriendRequests);
preparedStatement.setBoolean(12, entry.getValue().friendDisplayInventoryUI);
preparedStatement.setBoolean(13, entry.getValue().ClanTips);
+ preparedStatement.setBoolean(14, entry.getValue().HubMusic);
+ preparedStatement.setBoolean(15, entry.getValue().DisableAds);
System.out.println(">> " + entry.getValue().ClanTips);
- preparedStatement.setString(14, entry.getKey());
+ preparedStatement.setString(16, entry.getKey());
preparedStatement.execute();
}
@@ -122,6 +126,8 @@ public class PreferencesRepository extends RepositoryBase
preferences.PendingFriendRequests = resultSet.getBoolean(11);
preferences.friendDisplayInventoryUI = resultSet.getBoolean(12);
preferences.ClanTips = resultSet.getBoolean(13);
+ preferences.HubMusic = resultSet.getBoolean(14);
+ preferences.DisableAds = resultSet.getBoolean(15);
System.out.println("<< " + resultSet.getBoolean(13));
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/UserPreferences.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/UserPreferences.java
index 728f549e2..ee8e1ca3b 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/UserPreferences.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/UserPreferences.java
@@ -16,4 +16,6 @@ public class UserPreferences
public boolean PendingFriendRequests = true;
public boolean friendDisplayInventoryUI = true;
public boolean ClanTips = true;
+ public volatile boolean HubMusic = true;
+ public boolean DisableAds = false;
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/ExclusivePreferencesPage.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/ExclusivePreferencesPage.java
index 53c774a0e..272b5fe38 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/ExclusivePreferencesPage.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/ExclusivePreferencesPage.java
@@ -189,6 +189,6 @@ public class ExclusivePreferencesPage extends ShopPageBase= _teamNames.length)
+ continue;
+
//Update
Team team = _scoreboard.getTeam(_teamNames[i]);
if (team == null)
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java
index 4b60646f1..7ec46f8f9 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java
@@ -91,41 +91,14 @@ public class StatsManager extends MiniDbClientPlugin
UtilServer.getServer().getPluginManager().callEvent(new StatChangeEvent(player.getName(), statName, newValue - value, newValue));
// Verify stat is in our local cache, if not add it remotely.
- if (!_stats.containsKey(statName))
+ registerNewStat(statName, new Runnable()
{
- runAsync(new Runnable()
+ @Override
+ public void run()
{
- public void run()
- {
- synchronized (_statSync)
- {
- // If many players come in for a new stat, when the first add finishes the others are queued to add again
- // This makes a second check for the stat name (already added before lock was released)
- // Then it pops into queue and forgets adding the new stat to db.
- if (_stats.containsKey(statName))
- {
- addToQueue(statName, player, value);
- return;
- }
-
- _repository.addStat(statName);
-
- _stats.clear();
-
- for (Stat stat : _repository.retrieveStats())
- {
- _stats.put(stat.Name, stat.Id);
- }
-
- addToQueue(statName, player, value);
- }
- }
- });
- }
- else
- {
- addToQueue(statName, player, value);
- }
+ addToQueue(statName, player, value);
+ }
+ });
}
private void addToQueue(String statName, Player player, long value)
@@ -192,23 +165,51 @@ public class StatsManager extends MiniDbClientPlugin
public boolean incrementStat(final int accountId, final String statName, final long value)
{
- if (_stats.containsKey(statName))
- return false;
-
- final NautHashMap> uploadQueue = new NautHashMap>();
- uploadQueue.put(accountId, new NautHashMap());
- uploadQueue.get(accountId).put(_stats.get(statName), value);
-
- runAsync(new Runnable()
+ // This will register a new stat if we don't have one, otherwise it will just run the callback
+ registerNewStat(statName, new Runnable()
{
+ @Override
public void run()
{
+ final NautHashMap> uploadQueue = new NautHashMap>();
+ uploadQueue.put(accountId, new NautHashMap());
+ uploadQueue.get(accountId).put(_stats.get(statName), value);
+
_repository.saveStats(uploadQueue);
}
});
return true;
}
+
+ private void registerNewStat(final String statName, final Runnable callback)
+ {
+ runAsync(new Runnable()
+ {
+ public void run()
+ {
+ synchronized (_statSync)
+ {
+ if (_stats.containsKey(statName))
+ {
+ if (callback != null) callback.run();
+ return;
+ }
+
+ _repository.addStat(statName);
+
+ _stats.clear();
+
+ for (Stat stat : _repository.retrieveStats())
+ {
+ _stats.put(stat.Name, stat.Id);
+ }
+
+ if (callback != null) callback.run();
+ }
+ }
+ });
+ }
public int getStatId(String statName)
{
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/GiveawayMessageHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/GiveawayMessageHandler.java
index 93bd6183e..3afc7c3c1 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/GiveawayMessageHandler.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/GiveawayMessageHandler.java
@@ -32,7 +32,7 @@ public class GiveawayMessageHandler implements CommandCallback
String playerName = message.getPlayerName();
int count = message.getTitanCount();
String countString = count + UtilTime.getDayOfMonthSuffix(count);
- String chatMessage = C.cRed + playerName + C.cWhite + " found Titan in a " + C.cRed + "Flaming Pumpkin";
+ String chatMessage = C.cRed + playerName + C.cWhite + " found Titan in a " + C.cRed + "Christmas Present";
UtilTextMiddle.display(C.cDRed + C.Bold + "TITAN", chatMessage, 20, 80, 20, UtilServer.getPlayers());
World world = UtilServer.getPlayers().length > 0 ? UtilServer.getPlayers()[0].getWorld() : Bukkit.getWorlds().get(0);
LightFlicker lightFlicker = new LightFlicker(world);
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/TitanChestGiveawayHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/TitanChestGiveawayHandler.java
index 65081a2d8..0c99ada73 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/TitanChestGiveawayHandler.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/redis/TitanChestGiveawayHandler.java
@@ -16,18 +16,20 @@ public class TitanChestGiveawayHandler implements CommandCallback
private ServerStatusManager _statusManager;
private long _lastTimer;
+ private boolean _enabled;
public TitanChestGiveawayHandler(ServerStatusManager statusManager)
{
_statusManager = statusManager;
_lastTimer = 0;
+ _enabled = false;
}
@Override
public void run(ServerCommand command)
{
- if (command instanceof TitanChestGiveawayMessage)
+ if (command instanceof TitanChestGiveawayMessage && _enabled)
{
TitanChestGiveawayMessage chestCommand = ((TitanChestGiveawayMessage) command);
if (chestCommand.getServer().equals(_statusManager.getCurrentServerName()) || System.currentTimeMillis() >= _lastTimer + COOLDOWN)
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java
index 0e35252e8..ce3ff1b86 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java
@@ -49,7 +49,7 @@ import net.minecraft.server.v1_8_R3.MinecraftServer;
public class Clans extends JavaPlugin
{
- public static final String VERSION = "0.16";
+ public static final String VERSION = "0.17b";
private String WEB_CONFIG = "webServer";
// Modules
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java
index dc53b6069..5e82714fe 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java
@@ -462,7 +462,7 @@ public class ClanInfo
public boolean isOnline()
{
- return isOnlineNow() || System.currentTimeMillis() - _lastOnline.getTime() < Clans.getOnlineTime();
+ return isOnlineNow();// || System.currentTimeMillis() - _lastOnline.getTime() < Clans.getOnlineTime();
}
public String getProtected()
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java
index 7cfea3b08..9d06f8fa4 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java
@@ -17,13 +17,15 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilWorld;
import mineplex.game.clans.clans.event.ClanCreatedEvent;
import mineplex.game.clans.clans.event.ClanDeleteEvent;
+import mineplex.game.clans.clans.event.ClanJoinEvent;
+import mineplex.game.clans.clans.event.ClanLeaveEvent;
import mineplex.game.clans.clans.event.ClanSetHomeEvent;
import mineplex.game.clans.clans.scoreboard.ClansScoreboardManager;
import mineplex.game.clans.clans.tntGenerator.TntGenerator;
-import mineplex.game.clans.core.war.ClanWarData;
import mineplex.game.clans.core.repository.ClanRepository;
import mineplex.game.clans.core.repository.ClanTerritory;
import mineplex.game.clans.core.repository.tokens.ClanToken;
+import mineplex.game.clans.core.war.ClanWarData;
public class ClansDataAccessLayer
{
@@ -201,6 +203,15 @@ public class ClansDataAccessLayer
public void join(final ClanInfo clan, final Player player, final ClanRole role, final Callback callback)
{
+ ClanJoinEvent event = new ClanJoinEvent(clan, player);
+
+ UtilServer.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled())
+ {
+ return;
+ }
+
runAsync(new Runnable()
{
@Override
@@ -259,6 +270,15 @@ public class ClansDataAccessLayer
{
if (clan == null) return;
+ ClanLeaveEvent event = new ClanLeaveEvent(clan, clansPlayer);
+
+ UtilServer.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled())
+ {
+ return;
+ }
+
runAsync(new Runnable()
{
@Override
@@ -636,6 +656,10 @@ public class ClansDataAccessLayer
{
final Timestamp currentTime = new Timestamp(System.currentTimeMillis());
final ClanWarData war = new ClanWarData(clanA.getName(), clanB.getName(), score, currentTime, currentTime, 0);
+
+ // Memory
+ clanA.addWar(war);
+ clanB.addWar(war);
runAsync(new Runnable()
{
@@ -649,10 +673,6 @@ public class ClansDataAccessLayer
@Override
public void run()
{
- // Memory
- clanA.addWar(war);
- clanB.addWar(war);
-
_manager.log("Initiator war for [" + clanA.getName() + "] against [" + clanB.getName() + "].");
if (warCallback != null) warCallback.run(war);
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java
index aa8efa0bb..d97ad7c78 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java
@@ -66,6 +66,7 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClanTips.TipType;
import mineplex.game.clans.clans.ClansUtility.ClanRelation;
+import mineplex.game.clans.clans.claimview.ClaimVisualizer;
import mineplex.game.clans.clans.commands.ClanManagementCommand;
import mineplex.game.clans.clans.commands.ClansAllyChatCommand;
import mineplex.game.clans.clans.commands.ClansChatCommand;
@@ -304,6 +305,8 @@ public class ClansManager extends MiniClientPluginimplements IRelati
loadClan(token);
}
+// new ClaimVisualizer(plugin, this);
+
// RedisDataRepository(ConnectionData writeConn, ConnectionData
// readConn, Region region, Class elementType, String elementLabel)
// Initialize default region factions and territory
@@ -672,7 +675,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati
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.getPlayer().getGameMode().equals(GameMode.CREATIVE) ? C.cRed + "Creative " : " ") + event.getMessage());
+ System.out.println(_clientManager.Get(event.getPlayer()).GetRank().name() + " " + event.getPlayer().getName() + " " + event.getMessage());
return;
}
@@ -692,7 +695,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati
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() + " " + (event.getPlayer().getGameMode().equals(GameMode.CREATIVE) ? C.cRed + "Creative " : " ") + C.cWhite + message;
+ String formatted = rank + rel.getColor(true) + clan.getName() + " " + rel.getColor(false) + event.getPlayer().getName() + " " + C.cWhite + message;
other.sendMessage(formatted);
}
}
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java
index c30741532..c27bcf57a 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java
@@ -717,11 +717,11 @@ public class ClansUtility
return false;
}
-// if (clan.getEnergy() == 0)
-// {
-// Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must purchase energy at a shop before you can claim land."));
-// return false;
-// }
+ if (clan.getEnergy() == 0)
+ {
+ Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must purchase energy at a shop before you can claim land."));
+ return false;
+ }
String chunk = UtilWorld.chunkToStr(caller.getLocation().getChunk());
ClanInfo ownerClan = getOwner(caller.getLocation());
@@ -740,11 +740,11 @@ public class ClansUtility
}
}
-// if (clan.getClaims() >= clan.getClaimsMax())
-// {
-// Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan cannot claim more Territory."));
-// return false;
-// }
+ if (clan.getClaims() >= clan.getClaimsMax())
+ {
+ Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan cannot claim more Territory."));
+ return false;
+ }
// Adjacent
boolean selfAdj = false;
@@ -1084,7 +1084,7 @@ public class ClansUtility
}
// Event
- PlayerUnClaimTerritoryEvent event = new PlayerUnClaimTerritoryEvent(caller, caller.getLocation().getChunk());
+ PlayerUnClaimTerritoryEvent event = new PlayerUnClaimTerritoryEvent(caller, caller.getLocation().getChunk(), ownerClan);
UtilServer.getServer().getPluginManager().callEvent(event);
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/ClaimVisualizer.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/ClaimVisualizer.java
new file mode 100644
index 000000000..9408255bd
--- /dev/null
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/ClaimVisualizer.java
@@ -0,0 +1,351 @@
+package mineplex.game.clans.clans.claimview;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.bukkit.Bukkit;
+import org.bukkit.Chunk;
+import org.bukkit.Location;
+import org.bukkit.block.Block;
+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 org.bukkit.util.Vector;
+
+import mineplex.core.MiniPlugin;
+import mineplex.core.common.util.F;
+import mineplex.core.common.util.NautHashMap;
+import mineplex.core.common.util.UtilBlock;
+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.UtilWorld;
+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.claimview.commands.ClaimVisualizeCommand;
+import mineplex.game.clans.clans.event.ClanDisbandedEvent;
+import mineplex.game.clans.clans.event.ClanLeaveEvent;
+import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
+import mineplex.game.clans.clans.event.PlayerUnClaimTerritoryEvent;
+import net.minecraft.server.v1_8_R3.EnumDirection;
+
+public class ClaimVisualizer extends MiniPlugin
+{
+ private ClansManager _clansManager;
+
+ private List _visualizing;
+
+ private NautHashMap> _calculated;
+
+ public ClaimVisualizer(JavaPlugin plugin, ClansManager clansManager)
+ {
+ super("Claim Visualizer", plugin);
+
+ _clansManager = clansManager;
+ _visualizing = new ArrayList<>();
+ _calculated = new NautHashMap<>();
+
+ for (ClanInfo clan : _clansManager.getClanMap().values())
+ {
+ _calculated.put(clan, new NautHashMap());
+ }
+ }
+
+ @Override
+ public void addCommands()
+ {
+ addCommand(new ClaimVisualizeCommand(this));
+ }
+
+ @EventHandler
+ public void update(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.SLOWER)
+ {
+ return;
+ }
+
+ _calculated.clear();
+ for (ClanInfo clan : _clansManager.getClanMap().values())
+ {
+ _calculated.put(clan, new NautHashMap());
+
+ for (String serialized : clan.getClaimSet())
+ {
+ calculate(clan, serialized);
+ }
+ }
+ }
+
+ @EventHandler
+ public void runVisualization(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.SEC)
+ {
+ return;
+ }
+
+ for (String name : _visualizing)
+ {
+ Player player = Bukkit.getPlayer(name);
+
+ if (player != null && _clansManager.isInClan(player))
+ {
+ visualize(player);
+ }
+ }
+ }
+
+ private void visualize(Player player)
+ {
+ for (String serialized : _clansManager.getClan(player).getClaimSet())
+ {
+ if (!_calculated.get(_clansManager.getClan(player)).containsKey(serialized))
+ {
+ calculate(_clansManager.getClan(player), serialized);
+ }
+ }
+
+ draw(player, _calculated.get(_clansManager.getClan(player)).values());
+ }
+
+ private void draw(Player player, Collection chunks)
+ {
+ for (VisualizedChunkData chunk : chunks)
+ {
+ if (!chunk.getChunk().getWorld().equals(player.getWorld()))
+ {
+ // return not break because a clan can't have claims in different worlds.
+ return;
+ }
+
+ if (UtilMath.offset2d(chunk.getChunk().getBlock(0, 0, 0).getLocation(), player.getLocation()) > 36)
+ {
+ break;
+ }
+
+ for (int x = 0; x < 16; x++)
+ {
+ for (int z = 0; z < 16; z++)
+ {
+ if (chunk.shouldDisplayEdge(x, z) && (z == 0 || z == 15 || x == 0 || x == 15))
+ {
+ Block block = chunk.getChunk().getBlock(x, 0, z);
+
+ UtilParticle.PlayParticle(ParticleType.RED_DUST,
+ new Location(
+ chunk.getChunk().getWorld(),
+ block.getX() + .5,
+ UtilBlock.getHighest(player.getWorld(), block.getX(), block.getZ()).getY() + .5,
+ block.getZ() + .5),
+ new Vector(0f, 0f, 0f), 0f, 1, ViewDist.NORMAL, player);
+ }
+ }
+ }
+ }
+ }
+
+ private void calculate(ClanInfo clan, String serialized)
+ {
+ Chunk chunk = UtilWorld.strToChunk(serialized);
+
+ List dirs = new ArrayList<>();
+
+ if (!clan.getClaimSet().contains(UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX(), chunk.getZ() - 1))))
+ {
+ dirs.add(EnumDirection.NORTH);
+ }
+
+ if (!clan.getClaimSet().contains(UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX() + 1, chunk.getZ()))))
+ {
+ dirs.add(EnumDirection.EAST);
+ }
+
+ if (!clan.getClaimSet().contains(UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX(), chunk.getZ() + 1))))
+ {
+ dirs.add(EnumDirection.SOUTH);
+ }
+
+ if (!clan.getClaimSet().contains(UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX() - 1, chunk.getZ()))))
+ {
+ dirs.add(EnumDirection.WEST);
+ }
+
+ VisualizedChunkData cached = new VisualizedChunkData(chunk, dirs);
+
+ _calculated.get(clan).put(serialized, cached);
+ }
+
+ @EventHandler
+ public void onQuit(PlayerQuitEvent event)
+ {
+ if (isVisualizing(event.getPlayer()))
+ {
+ disableVisualizer(event.getPlayer());
+ }
+ }
+
+ @EventHandler
+ public void onKick(PlayerKickEvent event)
+ {
+ if (isVisualizing(event.getPlayer()))
+ {
+ disableVisualizer(event.getPlayer());
+ }
+ }
+
+ @EventHandler
+ public void onLeave(ClanLeaveEvent event)
+ {
+ if (isVisualizing(event.getPlayer().getPlayerName()))
+ {
+ disableVisualizer(event.getPlayer().getPlayerName());
+ }
+ }
+
+ @EventHandler
+ public void onClanDisband(ClanDisbandedEvent event)
+ {
+ for (Player player : event.getClan().getOnlinePlayers())
+ {
+ if (isVisualizing(player))
+ {
+ disableVisualizer(player);
+ }
+ }
+ }
+
+ @EventHandler
+ public void update(ClanInfo clan)
+ {
+ _calculated.clear();
+
+ for (String serialized : clan.getClaimSet())
+ {
+ calculate(clan, serialized);
+ }
+ }
+
+ @EventHandler
+ public void onUnclaim(PlayerUnClaimTerritoryEvent event)
+ {
+ if (event.getClan().getClaimCount() == 1)
+ {
+ for (Player player : event.getClan().getOnlinePlayers())
+ {
+ if (isVisualizing(player))
+ {
+ disableVisualizer(player);
+ }
+ }
+ }
+ }
+
+ public boolean isVisualizing(Player player)
+ {
+ return _visualizing.contains(player.getName());
+ }
+
+ public boolean isVisualizing(String name)
+ {
+ return _visualizing.contains(name);
+ }
+
+ public void enableVisualizer(String name)
+ {
+ enableVisualizer(UtilServer.getServer().getPlayer(name));
+ }
+
+ public void disableVisualizer(String name)
+ {
+ disableVisualizer(UtilServer.getServer().getPlayer(name));
+ }
+
+ public void toggleVisualizer(Player player)
+ {
+ if (_visualizing.contains(player.getName()))
+ {
+ disableVisualizer(player);
+ }
+ else
+ {
+ enableVisualizer(player);
+ }
+ }
+
+ public void enableVisualizer(Player player)
+ {
+ if (player == null)
+ {
+ return;
+ }
+
+ if (!_clansManager.isInClan(player))
+ {
+ UtilPlayer.message(player, F.main("Clans", "You must be in a clan to visualize claims."));
+ return;
+ }
+
+ ClanInfo clan = _clansManager.getClan(player);
+
+ if (clan.getClaimCount() == 0)
+ {
+ UtilPlayer.message(player, F.main("Clans", "Your Clan does not have any claims!"));
+ return;
+ }
+
+ _visualizing.add(player.getName());
+ UtilPlayer.message(player, F.main("Clans", "You are now visualizing your claims."));
+
+ for (VisualizedChunkData chunk : _calculated.get(clan).values())
+ {
+ if (!chunk.getChunk().getWorld().equals(player.getWorld()))
+ {
+ // return not break because a clan can't have claims in different worlds.
+ return;
+ }
+
+ if (UtilMath.offset2d(chunk.getChunk().getBlock(0, 0, 0).getLocation(), player.getLocation()) > 36)
+ {
+ break;
+ }
+
+ for (int x = 0; x < 16; x++)
+ {
+ for (int z = 0; z < 16; z++)
+ {
+ if (chunk.shouldDisplayEdge(x, z) && (z == 0 || z == 15 || x == 0 || x == 15))
+ {
+ Block block = chunk.getChunk().getBlock(x, 0, z);
+ }
+ }
+ }
+ }
+ }
+
+ public void disableVisualizer(Player player)
+ {
+ if (player == null)
+ {
+ return;
+ }
+
+ if (!_visualizing.contains(player.getName()))
+ {
+ UtilPlayer.message(player, F.main("Clans", "You are anot visualizing your claims."));
+ return;
+ }
+
+ _visualizing.remove(player.getName());
+ UtilPlayer.message(player, F.main("Clans", "You are no longer visualizing your claims."));
+ }
+
+}
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/VisualizedChunkData.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/VisualizedChunkData.java
new file mode 100644
index 000000000..1427f20ae
--- /dev/null
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/VisualizedChunkData.java
@@ -0,0 +1,57 @@
+package mineplex.game.clans.clans.claimview;
+
+import java.util.List;
+
+import org.bukkit.Chunk;
+
+import net.minecraft.server.v1_8_R3.EnumDirection;
+
+public class VisualizedChunkData
+{
+ private List _displayableEdges;
+ private Chunk _chunk;
+
+ public long _start;
+
+ public VisualizedChunkData(Chunk chunk, List dir)
+ {
+ _chunk = chunk;
+ _displayableEdges = dir;
+ _start = System.currentTimeMillis();
+ }
+
+ public double getLife()
+ {
+ return (double) (System.currentTimeMillis() - _start);
+ }
+
+ public boolean shouldDisplayEdge(int x, int z)
+ {
+ if (z == 15 && !_displayableEdges.contains(EnumDirection.SOUTH))
+ {
+ return false;
+ }
+
+ if (x == 15 && !_displayableEdges.contains(EnumDirection.EAST))
+ {
+ return false;
+ }
+
+ if (x == 0 && !_displayableEdges.contains(EnumDirection.WEST))
+ {
+ return false;
+ }
+
+ if (z == 0 && !_displayableEdges.contains(EnumDirection.NORTH))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public Chunk getChunk()
+ {
+ return _chunk;
+ }
+}
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/commands/ClaimVisualizeCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/commands/ClaimVisualizeCommand.java
new file mode 100644
index 000000000..dcfa074c9
--- /dev/null
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/claimview/commands/ClaimVisualizeCommand.java
@@ -0,0 +1,22 @@
+package mineplex.game.clans.clans.claimview.commands;
+
+import org.bukkit.entity.Player;
+
+import mineplex.core.command.CommandBase;
+import mineplex.core.common.Rank;
+import mineplex.game.clans.clans.claimview.ClaimVisualizer;
+
+public class ClaimVisualizeCommand extends CommandBase
+{
+ public ClaimVisualizeCommand(ClaimVisualizer plugin)
+ {
+ super(plugin, Rank.ALL, "showclaims");
+ }
+
+ @Override
+ public void Execute(Player caller, String[] args)
+ {
+ Plugin.toggleVisualizer(caller);
+ }
+
+}
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClanManagementCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClanManagementCommand.java
index 546c63774..cda7ab480 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClanManagementCommand.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClanManagementCommand.java
@@ -38,7 +38,6 @@ import mineplex.game.clans.items.legendaries.WindBlade;
public class ClanManagementCommand extends CommandBase
{
-
private ClansManager _clansManager;
public ClanManagementCommand(ClansManager plugin)
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java
index b956eedfe..f9bab36a5 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java
@@ -1,5 +1,6 @@
package mineplex.game.clans.clans.commands;
+import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
@@ -24,6 +25,7 @@ import mineplex.game.clans.clans.ClanTips.TipType;
import mineplex.game.clans.clans.ClansBlacklist;
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;
@@ -382,6 +384,10 @@ public class ClansCommand extends CommandBase
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "The clan " + F.elem("Clan " + clan.getName()) + " is full and cannot be joined!"));
return;
}
+
+ ClanJoinEvent event = new ClanJoinEvent(clan, caller);
+ Bukkit.getPluginManager().callEvent(event);
+ if (event.isCancelled()) return;
// Task
Plugin.getClanDataAccess().join(clan, caller, ClanRole.RECRUIT, new Callback()
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/RestartTutCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/RestartTutCommand.java
index be19befc8..a37102d7b 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/RestartTutCommand.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/RestartTutCommand.java
@@ -6,6 +6,8 @@ import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
+import mineplex.core.common.util.F;
+import mineplex.core.common.util.UtilPlayer;
import mineplex.core.task.TaskManager;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.tutorials.Tutorial;
@@ -22,6 +24,12 @@ public class RestartTutCommand extends CommandBase
@Override
public void Execute(Player caller, String[] args)
{
+ if (ClansManager.getInstance().getClan(caller) != null)
+ {
+ UtilPlayer.message(caller, F.main("Tutorial", "You cannot restart the tutorial while in a clan"));
+ return;
+ }
+
if (ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()) != null
&& ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()).isSafe(caller.getLocation()))
{
@@ -43,7 +51,7 @@ public class RestartTutCommand extends CommandBase
}
else
{
- TutorialManager.Instance.sendTutorialMsg(caller, "You must be in a safezone to restart the tutorial.");
+ TutorialManager.Instance.sendTutorialMsg(caller, F.main("Clans", "You must be in a Safe Zone to restart the tutorial."));
}
}
}
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClanLeaveEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClanLeaveEvent.java
new file mode 100644
index 000000000..3c5f6156d
--- /dev/null
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClanLeaveEvent.java
@@ -0,0 +1,56 @@
+package mineplex.game.clans.clans.event;
+
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+import mineplex.game.clans.clans.ClanInfo;
+import mineplex.game.clans.clans.ClansPlayer;
+
+public class ClanLeaveEvent extends Event
+{
+ private static final HandlerList handlers = new HandlerList();
+
+ private ClansPlayer _player;
+
+ private ClanInfo _clan;
+
+ private boolean _cancelled;
+
+ public ClanLeaveEvent(ClanInfo clan, ClansPlayer clansPlayer)
+ {
+ _player = clansPlayer;
+
+ _clan = clan;
+ }
+
+ public ClansPlayer getPlayer()
+ {
+ return _player;
+ }
+
+ public ClanInfo getClan()
+ {
+ return _clan;
+ }
+
+ public void setCancelled(boolean cancelled)
+ {
+ _cancelled = cancelled;
+ }
+
+ public boolean isCancelled()
+ {
+ return _cancelled;
+ }
+
+ public HandlerList getHandlers()
+ {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList()
+ {
+ return handlers;
+ }
+
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/PlayerUnClaimTerritoryEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/PlayerUnClaimTerritoryEvent.java
index 41ef2e8b1..8d83363d6 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/PlayerUnClaimTerritoryEvent.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/PlayerUnClaimTerritoryEvent.java
@@ -5,19 +5,23 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
+import mineplex.game.clans.clans.ClanInfo;
+
public class PlayerUnClaimTerritoryEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _unClaimer;
private Chunk _unClaimedChunk;
+ private ClanInfo _clan;
private boolean _cancelled;
- public PlayerUnClaimTerritoryEvent(Player unClaimer, Chunk unClaimedChunk)
+ public PlayerUnClaimTerritoryEvent(Player unClaimer, Chunk unClaimedChunk, ClanInfo clan)
{
_unClaimer = unClaimer;
_unClaimedChunk = unClaimedChunk;
+ _clan = clan;
}
public Player getUnClaimer()
@@ -35,6 +39,11 @@ public class PlayerUnClaimTerritoryEvent extends Event
_cancelled = cancelled;
}
+ public ClanInfo getClan()
+ {
+ return _clan;
+ }
+
public boolean isCancelled()
{
return _cancelled;
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/ClansScoreboardManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/ClansScoreboardManager.java
index dcefd85aa..c337f063f 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/ClansScoreboardManager.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/ClansScoreboardManager.java
@@ -42,19 +42,17 @@ public class ClansScoreboardManager extends ScoreboardManager
private void init(TutorialManager tutorialManager)
{
- setTitle(" MINEPLEX CLANS ");
+ setTitle("Clans Alpha " + Clans.VERSION);
ScoreboardData data = getData("default", true);
- data.write(C.cGreen + "Clans Alpha " + Clans.VERSION);
- data.writeEmpty();
data.writeElement(new ScoreboardElementClan(_clansManager));
data.writeElement(new ScoreboardElementPlayer(_clansManager));
- data.writeElement(new ScoreboardElementPlayerCount(_clansManager));
-
- data.writeElement(_worldEvent);
+// data.writeElement(new ScoreboardElementPlayerCount(_clansManager));
+
data.writeElement(_warManager);
-
+ data.writeElement(_worldEvent);
+
for (Tutorial tutorial : tutorialManager.getTutorials().values())
{
data.writeElement(tutorial);
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementClan.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementClan.java
index d27d2c34b..5252cb23d 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementClan.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementClan.java
@@ -35,8 +35,7 @@ public class ScoreboardElementClan implements ScoreboardElement
// Energy
if (clanInfo.getEnergyCostPerMinute() > 0)
- output.add(C.cYellow + "Energy " + C.cWhite + UtilTime.convertString((clanInfo.getEnergy() / clanInfo.getEnergyCostPerMinute()) * 60000L, 1, UtilTime.TimeUnit.FIT));
- output.add(C.cYellow + "Home " + C.cWhite + clanInfo.getBedStatusStr());
+ output.add(C.cYellow + "Energy " + C.cWhite + UtilTime.convertString((clanInfo.getEnergy() / clanInfo.getEnergyCostPerMinute()) * 60000L, 1, UtilTime.TimeUnit.FIT));
}
else
{
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementPlayer.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementPlayer.java
index 36d4ac271..d0d710721 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementPlayer.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementPlayer.java
@@ -27,10 +27,9 @@ public class ScoreboardElementPlayer implements ScoreboardElement
{
List output = new ArrayList();
output.add(C.cYellow + "Gold " + C.cWhite + manager.getDonation().Get(player).GetBalance(CurrencyType.Gold) + "");
- output.add("");
-
String regionString = C.xWilderness + "Wilderness";
+ output.add(" ");
ClanTerritory claim = _clansManager.getClanUtility().getClaim(player.getLocation());
if (claim != null)
{
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementPlayerCount.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementPlayerCount.java
index be56178a3..0c6fb35d5 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementPlayerCount.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/scoreboard/elements/ScoreboardElementPlayerCount.java
@@ -29,7 +29,7 @@ public class ScoreboardElementPlayerCount implements ScoreboardElement
List output = new ArrayList();
output.add("");
- output.add(C.cYellow + "Players Online " + UtilServer.getPlayers().length + "/100");
+ output.add(C.cYellow + "Players " + C.cWhite + UtilServer.getPlayers().length + "/100");
return output;
}
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/war/WarManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/war/WarManager.java
index cc017df55..166693db2 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/war/WarManager.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/war/WarManager.java
@@ -97,7 +97,7 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
{
for (WarInvasion invasion : invasions)
{
- if (invasion.getInvaderClan().equals(playerClan))
+ if (invasion.getInvaderClan().equals(playerClan.getName()))
return true;
}
}
@@ -125,15 +125,24 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
final ClanInfo killerClan = event.getKiller().getClan();
ClanWarData war = clan.getWarData(killerClan);
- if (war != null && !war.isOnCooldown())
+ if (war != null)
{
+ if (war.isOnCooldown())
+ {
+ // Ignore!
+ return;
+ }
+
+ _clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer());
+ _clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer());
+
// War already exists
+ war.increment(killerClan.getName());
ClansUtility.ClanRelation rel = _clansManager.getClanUtility().rel(clan, killerClan);
_clansManager.messageClan(killerClan, F.main("Clans", "Your clan gained 1 War Point against " + rel.getColor(false) +
clan.getName() + " " + C.Reset + "(" + killerClan.getFormattedWarPoints(clan) + C.Reset + ")"));
_clansManager.messageClan(clan, F.main("Clans", "Your clan lost 1 War Point against " + rel.getColor(false) +
killerClan.getName() + " " + C.Reset + "(" + clan.getFormattedWarPoints(killerClan) + C.Reset + ")"));
- war.increment(killerClan.getName());
checkWarComplete(war);
ClanInfo clanA = clan.getName().equals(war.getClanA()) ? clan : killerClan;
@@ -142,9 +151,6 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
_clansManager.getScoreboard().refresh(killerClan);
_clansManager.getScoreboard().refresh(clan);
-
- _clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer());
- _clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer());
}
else
{
@@ -155,14 +161,13 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
public void run(ClanWarData data)
{
ClansUtility.ClanRelation rel = _clansManager.getClanUtility().rel(clan, killerClan);
+ _clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer());
+ _clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer());
_clansManager.messageClan(killerClan, F.main("Clans", "Your clan gained 1 War Point against " + rel.getColor(false) + clan.getName()));
_clansManager.messageClan(clan, F.main("Clans", "Your clan lost 1 War Point against " + rel.getColor(false) + killerClan.getName()));
_clansManager.getScoreboard().refresh(killerClan);
_clansManager.getScoreboard().refresh(clan);
-
- _clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer());
- _clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer());
}
});
}
@@ -271,7 +276,7 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
@EventHandler
public void onInvasionEnd(WarInvasionEndEvent event)
{
- Bukkit.broadcastMessage(F.main("War", F.elem(event.getWarInvasion().getInvaderClan()) + "'s invasion against " + F.elem(event.getWarInvasion().getInvaderClan() + " has ended.")));
+ Bukkit.broadcastMessage(F.main("War", F.elem(event.getWarInvasion().getInvaderClan()) + "'s invasion against " + F.elem(event.getWarInvasion().getInvadedClan()) + " has ended."));
}
@@ -301,13 +306,14 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
if (clan != null)
{
- List invadedList = _invadedMap.get(clan);
- List invaderList = _invaderMap.get(clan);
+ List invadedList = _invadedMap.get(clan.getName());
+ List invaderList = _invaderMap.get(clan.getName());
if (invaderList != null && !invaderList.isEmpty())
{
for (WarInvasion invasion : invaderList)
{
+ element.add(" ");
element.add(C.cPurpleB + "Invading");
element.add(" " + invasion.getInvadedClan());
element.add(" " + UtilTime.convertString(invasion.getTimeLeft(), 1, UtilTime.TimeUnit.FIT));
@@ -318,6 +324,7 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
{
for (WarInvasion invasion : invadedList)
{
+ element.add(" ");
element.add(C.cRedB + "Invaded");
element.add(" " + invasion.getInvaderClan());
element.add(" " + UtilTime.convertString(invasion.getTimeLeft(), 1, UtilTime.TimeUnit.FIT));
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/bow/HeavyArrowsAttribute.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/bow/HeavyArrowsAttribute.java
index 16aa30a21..f5e55d42c 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/bow/HeavyArrowsAttribute.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/bow/HeavyArrowsAttribute.java
@@ -35,6 +35,7 @@ public class HeavyArrowsAttribute extends ItemAttribute
@Override
public void onAttack(CustomDamageEvent event)
{
- event.AddKnockback("HeavyAttribute", _knockbackPercent);
+ double knockback = (_knockbackPercent / 100d) * 6;
+ event.AddKnockback("Heavy Attribute", knockback);
}
}
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/Spawn.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/Spawn.java
index dfca12bb5..50a251707 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/Spawn.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/Spawn.java
@@ -248,7 +248,7 @@ public class Spawn extends MiniPlugin
if (isInSpawn(player))
{
- UtilPlayer.message(event.GetPlayer(), F.main("Safe Zone", "You cannot use " + F.skill(event.GetSkillName() + " in " + F.elem("Safe Zone") + ".")));
+ UtilPlayer.message(event.GetPlayer(), F.main("Safe Zone", "You cannot use " + F.skill(event.GetSkillName()) + " in " + F.elem("Safe Zone") + "."));
event.SetCancelled(true);
}
}
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java
index 166dbc6e8..4d6ae6cc3 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/Tutorial.java
@@ -8,6 +8,7 @@ import java.util.Map;
import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type;
+import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -19,6 +20,7 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
+import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.core.common.jsonchat.ClickEvent;
@@ -27,6 +29,8 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilFirework;
+import mineplex.core.common.util.UtilInv;
+import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
@@ -40,6 +44,7 @@ import mineplex.core.task.TaskManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansManager;
+import mineplex.game.clans.clans.event.ClanJoinEvent;
import mineplex.game.clans.clans.event.ClanTipEvent;
import mineplex.game.clans.economy.GoldManager;
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
@@ -59,6 +64,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
public static String SKIPPED_TASK = "tatatatata%sSkip";
public static String AllowedMessage = C.cGold + "TutorialAllowedMessage" + C.Reset;
+ public static String AllowedBypass = C.cBlue + "Tutorial>";
protected final TutorialManager _manager;
protected final GoldManager _goldManager;
@@ -66,7 +72,8 @@ public abstract class Tutorial implements ScoreboardElement, Listener
protected final TaskManager _taskManager;
protected final DonationManager _donationManager;
- protected final LinkedHashMap> _tasks;
+// protected final LinkedHashMap> _tasks;
+ private final ArrayList> _tasks;
protected final LinkedHashMap> _nameToTask;
protected final LinkedHashMap _inTutorial;
@@ -89,7 +96,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
_donationManager = donationManager;
_taskManager = taskManager;
_manager = manager;
- _tasks = new LinkedHashMap<>();
+ _tasks = new ArrayList>();
_inTutorial = new LinkedHashMap<>();
_nameToTask = new LinkedHashMap<>();
@@ -122,7 +129,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
lines.add(C.cAqua + "Tutorial");
- for (final TutorialTask> task : _tasks.values())
+ for (final TutorialTask> task : _tasks)
{
if (get(player).CurrentTask.equals(task))
{
@@ -142,10 +149,15 @@ public abstract class Tutorial implements ScoreboardElement, Listener
return lines;
}
+
+ public TutorialTask> getTask(int index)
+ {
+ return _tasks.get(index);
+ }
protected void addTask(TutorialTask> task)
{
- _tasks.put(_tasks.size() + 1, task);
+ _tasks.add(task);
_nameToTask.put(task.getTechnicalName(), task);
}
@@ -158,6 +170,11 @@ public abstract class Tutorial implements ScoreboardElement, Listener
return get(player).CurrentTask.getID() < task.getID();
}
+
+ private TutorialTask> getLastTask()
+ {
+ return _tasks.get(_tasks.size() - 1);
+ }
protected void finishTask(final Player player, final TutorialTask> task)
{
@@ -175,8 +192,10 @@ public abstract class Tutorial implements ScoreboardElement, Listener
{
public void run()
{
+ final TutorialTask> lastTask = getLastTask();
// Cycle to next task, or null if last task.
- get(player).CurrentTask = task.equals(_tasks.get(_tasks.size())) ? null : _tasks.get(task.getID() + 1);
+ get(player).CurrentTask = task.equals(lastTask) ? null : _tasks.get(task.getDataId() + 1);
+ System.out.println("Next Task: " + get(player).CurrentTask);
if (!_taskManager.hasCompletedTask(player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName())))
{
@@ -185,7 +204,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
public void run(final Boolean completed)
{
// If last task, end tutorial.
- if (task.equals(_tasks.get(_tasks.size())))
+ if (task.equals(lastTask))
{
finishFor(player);
}
@@ -196,7 +215,9 @@ public abstract class Tutorial implements ScoreboardElement, Listener
{
public void run()
{
+ System.out.println("STARTING NEXT TASK!");
get(player).CurrentTask.startFor(player);
+ get(player).CurrentTaskStartTime = System.currentTimeMillis();
}
}, 30L);
}
@@ -252,23 +273,22 @@ public abstract class Tutorial implements ScoreboardElement, Listener
private void finishFor(final Player player)
{
- if (player.getOpenInventory() != null)
- {
- _inTutorial.get(player.getName()).QueuedFinish = true;
- return;
- }
-
+// if (player.getOpenInventory() != null)
+// {
+// _inTutorial.get(player.getName()).QueuedFinish = true;
+// return;
+// }
+ _manager.finishTutorial(player);
_inTutorial.remove(player.getName());
-
- UtilTextMiddle.display(C.cWhite + "Clans Tutorial", C.cGreen + "You have completed the Clans Tutorial!", 20, 20 * 3, 20);
+ onFinished(player);
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
{
public void run()
{
- // Custom Finish Method (usually messages)
- onFinished(player);
-
+ UtilTextMiddle.display(C.cWhite + "Clans Tutorial", C.cGreen + "You have completed the Clans Tutorial!", 20, 20 * 3, 20, player);
+ onFinishedDelay(player);
+
// Do Reward
if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_REWARD_TASK, _technicalName)))
{
@@ -305,6 +325,25 @@ public abstract class Tutorial implements ScoreboardElement, Listener
}
}, player, String.format(TUTORIAL_REWARD_TASK, _technicalName));
}
+ else
+ {
+ UtilInv.remove(player, Material.IRON_AXE, (byte) 0, 1);
+
+ UtilInv.remove(player, Material.IRON_HELMET, (byte) 0, 1);
+ UtilInv.remove(player, Material.IRON_CHESTPLATE, (byte) 0, 1);
+ UtilInv.remove(player, Material.IRON_LEGGINGS, (byte) 0, 1);
+ UtilInv.remove(player, Material.IRON_BOOTS, (byte) 0, 1);
+
+ ItemStack[] armor = player.getInventory().getArmorContents();
+ for (int i = 0 ; i < armor.length; i++)
+ {
+ if (UtilItem.isIronProduct(armor[i]))
+ {
+ armor[i] = null;
+ }
+ }
+ player.getInventory().setArmorContents(armor);
+ }
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
{
@@ -340,13 +379,17 @@ public abstract class Tutorial implements ScoreboardElement, Listener
}
}, 20 * 2);
}
- }, 20 * 4);
+ }, 20 * 2);
}
// Implementation left to sub classes.
protected void onFinished(final Player player)
{
}
+
+ protected void onFinishedDelay(final Player player)
+ {
+ }
// Implementation left to sub classes.
protected void onBegin(final Player player)
@@ -357,7 +400,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
{
if (!_manager.isInTutorial(player))
{
- _manager._playerTutorials.put(player.getName(), this);
+ _manager.setTutorial(player, this);
}
_inTutorial.put(player.getName(), new TutorialClient(player, this));
@@ -380,8 +423,12 @@ public abstract class Tutorial implements ScoreboardElement, Listener
public void cancelFor(final Player player)
{
+ get(player).CurrentTask.cleanup(player);
+ get(player).CurrentTaskStartTime = -1;
_inTutorial.remove(player.getName());
+ _manager.finishTutorial(player);
+
if (_ghostMode)
{
for (Player other : UtilServer.getPlayers())
@@ -402,11 +449,6 @@ public abstract class Tutorial implements ScoreboardElement, Listener
return _inTutorial.containsKey(player);
}
- public Map> getTasks()
- {
- return _tasks;
- }
-
public boolean hasCompleted(final Player player)
{
return _taskManager.hasCompletedTask(player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName));
@@ -419,9 +461,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
public void skip(final Player player)
{
- new JsonMessage(
- AllowedMessage
- )
+ new JsonMessage("")
.extra(
F.main(
"Tutorial",
@@ -435,9 +475,11 @@ public abstract class Tutorial implements ScoreboardElement, Listener
.color("yellow")
.extra("!")
.color("gray")
+
.sendToPlayer(player);
- new JsonMessage(
+ new JsonMessage("")
+ .extra(
F.main(
"Tutorial",
"Click "
@@ -506,7 +548,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
}
}
- get(player).CurrentTask.trySendDescription(player);
+ get(player).CurrentTask.trySendDescription(player, false);
}
}
}
@@ -532,6 +574,15 @@ public abstract class Tutorial implements ScoreboardElement, Listener
evt.setCancelled(true);
}
+ @EventHandler
+ public void onJoinClan(ClanJoinEvent event)
+ {
+ if (isInTutorial(event.getPlayer()))
+ {
+ event.setCancelled(true);
+ }
+ }
+
@EventHandler
public void onPlayerJoin(final PlayerJoinEvent evt)
{
@@ -552,9 +603,15 @@ public abstract class Tutorial implements ScoreboardElement, Listener
public void cleanup(Player player)
{
- if (get(player) != null && get(player).CurrentTask != null)
+ System.out.println("Cleaning up Player in " + getClass().getName());
+
+ if (get(player) != null && get(player).CurrentTask != null)
+ {
+ System.out.println("Cleaning up current task: " + get(player).CurrentTask.getClass().getName());
get(player).CurrentTask.cleanup(player);
-
+ }
+
+ System.out.println("removing from in tutorial");
_inTutorial.remove(player.getName());
}
}
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialClient.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialClient.java
index 043647117..ac44d52a1 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialClient.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialClient.java
@@ -11,15 +11,18 @@ public class TutorialClient
public long LastDescriptionSentTime = System.currentTimeMillis() - 3000;
public boolean InClanOnStart;
public boolean QueuedFinish;
+ public long CurrentTaskStartTime;
public TutorialClient(Player player, Tutorial tutorial)
{
Player = player;
- CurrentTask = tutorial._tasks.get(1);
+ CurrentTask = tutorial.getTask(0);
+ CurrentTaskStartTime = System.currentTimeMillis();
InClanOnStart = tutorial._clansManager.isInClan(player);
-
+
+ /*
for (TutorialTask> task : tutorial._tasks.values())
{
if (TaskManager.Instance.hasCompletedTask(player, String.format(
@@ -34,5 +37,6 @@ public class TutorialClient
}
}
}
+ */
}
}
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java
index 7a637f7ba..7468ff139 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialManager.java
@@ -25,6 +25,7 @@ import mineplex.game.clans.tutorials.commands.DoSkipTutorialCommand;
import mineplex.game.clans.tutorials.commands.SkipTutorialCommand;
import mineplex.game.clans.tutorials.gettingstarted.TutorialGettingStarted;
import net.md_5.bungee.api.ChatColor;
+import net.minecraft.server.v1_8_R3.IChatBaseComponent;
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
public class TutorialManager extends MiniPlugin
@@ -32,7 +33,7 @@ public class TutorialManager extends MiniPlugin
public static TutorialManager Instance;
private final Map, Tutorial> _tutorials = new HashMap<>();
- protected final Map _playerTutorials = new HashMap<>();
+ private final Map _playerTutorials = new HashMap<>();
private final TaskManager _taskManager;
@@ -64,7 +65,7 @@ public class TutorialManager extends MiniPlugin
{
chat.a.a().remove(0);
}
- else
+ else if (!chat.a.a().get(0).c().contains(Tutorial.AllowedBypass))
{
if (isInTutorial(packet.getPlayer()))
{
@@ -138,10 +139,13 @@ public class TutorialManager extends MiniPlugin
@EventHandler
public void quit(PlayerQuitEvent event)
{
+ System.out.println("Player Quit. In Tutorial: " + isInTutorial(event.getPlayer()));
+
if (!isInTutorial(event.getPlayer()))
return;
getTutorial(event.getPlayer()).cleanup(event.getPlayer());
+ _playerTutorials.remove(event.getPlayer().getName());
}
public void sendTutorialMsg(Player player, String message)
@@ -156,6 +160,16 @@ public class TutorialManager extends MiniPlugin
sendTutorialMsg(player, message);
}
}
+
+ public void finishTutorial(Player player)
+ {
+ _playerTutorials.remove(player.getName());
+ }
+
+ public void setTutorial(Player player, Tutorial tutorial)
+ {
+ _playerTutorials.put(player.getName(), tutorial);
+ }
public Tutorial getTutorial(final Player player)
{
@@ -171,4 +185,72 @@ public class TutorialManager extends MiniPlugin
{
return _taskManager;
}
+
+ // Stolen from UtilTabTitle
+ private static class TextConverter
+ {
+ public static String convert(String text)
+ {
+ if (text == null || text.length() == 0)
+ {
+ return "\"\"";
+ }
+
+ char c;
+ int i;
+ int len = text.length();
+ StringBuilder sb = new StringBuilder(len + 4);
+ String t;
+ sb.append('"');
+
+ for (i = 0; i < len; i += 1)
+ {
+ c = text.charAt(i);
+ switch (c)
+ {
+ case '\\':
+ case '"':
+ sb.append('\\');
+ sb.append(c);
+ break;
+ case '/':
+ sb.append('\\');
+ sb.append(c);
+ break;
+ case '\b':
+ sb.append("\\b");
+ break;
+ case '\t':
+ sb.append("\\t");
+ break;
+ case '\n':
+ sb.append("\\n");
+ break;
+ case '\f':
+ sb.append("\\f");
+ break;
+ case '\r':
+ sb.append("\\r");
+ break;
+ default:
+ if (c < ' ')
+ {
+ t = "000" + Integer.toHexString(c);
+ sb.append("\\u").append(t.substring(t.length() - 4));
+ }
+ else
+ {
+ sb.append(c);
+ }
+ }
+ }
+ sb.append('"');
+ return sb.toString();
+ }
+
+ public static String setPlayerName(Player player, String text)
+ {
+ return text.replaceAll("(?i)\\{PLAYER\\}", player.getName());
+ }
+ }
}
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialTask.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialTask.java
index 0934fff08..6b4d2a332 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialTask.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/TutorialTask.java
@@ -1,13 +1,21 @@
package mineplex.game.clans.tutorials;
+import java.util.Iterator;
+
+import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautArrayList;
import mineplex.core.common.util.UtilServer;
+import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilTextMiddle;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager;
public class TutorialTask implements Listener
@@ -22,6 +30,8 @@ public class TutorialTask implements Listener
protected String _description;
protected String _finishMessage;
+ protected String[] _subtasks;
+
protected Location _taskPos;
// How much time after the beginning the task/last teleport it should take to teleport back to _taskPos.
@@ -29,7 +39,6 @@ public class TutorialTask implements Listener
protected long _descriptionWaitTime = 30000;
- protected NautArrayList _playersFinished = new NautArrayList<>();
protected NautArrayList _inTask = new NautArrayList<>();
private long _lastTaskTp;
@@ -55,7 +64,7 @@ public class TutorialTask implements Listener
{
_inTask.add(player.getName());
- trySendDescription(player);
+ trySendDescription(player, true);
customStartFor(player);
@@ -92,12 +101,41 @@ public class TutorialTask implements Listener
}
}
+ //@EventHandler
+ //todo: fix the multiline subtitles
+ public void displaySubtasks(UpdateEvent event)
+ {
+ if (!event.getType().equals(UpdateType.SEC))
+ {
+ return;
+ }
+
+ if (_subtasks == null || _subtasks.length == 0)
+ {
+ return;
+ }
+
+ Iterator iterator = _inTask.iterator();
+ while (iterator.hasNext())
+ {
+ Player player = Bukkit.getPlayer(iterator.next());
+
+ if ((System.currentTimeMillis() - _tutorial.get(player).CurrentTaskStartTime) >= 15000)
+ {
+ if (isDoing(player))
+ {
+ UtilTextMiddle.display("", UtilText.arrayToString(_subtasks, "\n"), 1, 25, 25, player);
+ }
+ }
+ }
+ }
+
public boolean isDoing(Player player)
{
return _inTask != null && player != null && _inTask.contains(player.getName());
}
- public void trySendDescription(Player player)
+ public void trySendDescription(Player player, boolean force)
{
if (!_tutorial.isInTutorial(player))
{
@@ -111,19 +149,24 @@ public class TutorialTask implements Listener
return;
}
- if (System.currentTimeMillis() - client.LastDescriptionSentTime > client.CurrentTask.getDescriptionWaitTime())
+ if (force || System.currentTimeMillis() - client.LastDescriptionSentTime > client.CurrentTask.getDescriptionWaitTime())
{
+ String description = _description;
+ ClanInfo clan = getClans().getClan(player);
+ if (clan != null) description = description.replace("(clan)", clan.getName());
+ description = description.replace("{", C.cAqua).replace("}", C.cWhite);
+
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
_tutorial._manager.sendTutorialMsg(player, " ");
- _tutorial._manager.sendTutorialMsg(player, C.cYellowB + "Part " + _id + ": " + _displayName);
- _tutorial._manager.sendTutorialMsg(player, C.cWhite + " " + _description.replace("{", C.cAqua).replace("}", C.cWhite));
+ _tutorial._manager.sendTutorialMsg(player, C.cYellowB + "Part " + (_id + 1) + ": " + _displayName);
+ _tutorial._manager.sendTutorialMsg(player, C.cWhite + " " + description);
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
- UtilTextMiddle.display("", getDisplayName());
+ UtilTextMiddle.display("", getDisplayName(), player);
client.LastDescriptionSentTime = System.currentTimeMillis();
}
@@ -169,30 +212,39 @@ public class TutorialTask implements Listener
{
return _tutorial._clansManager;
}
-
- public int getID()
+
+ public int getDataId()
{
return _id;
}
+ public int getID()
+ {
+ return _id + 1;
+ }
+
public void finishFor(Player player)
{
customEndFor(player);
+ cleanup(player);
_tutorial.finishTask(player, this);
}
public void visibleFinish(Player player)
{
- _inTask.remove(player.getName());
-
if (_finishMessage != null)
{
+ String finishMessage = _finishMessage;
+ ClanInfo clan = getClans().getClan(player);
+ if (clan != null) finishMessage = finishMessage.replace("(clan)", clan.getName());
+ finishMessage = finishMessage.replace("{", C.cAqua).replace("}", C.cWhite);
+
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
_tutorial._manager.sendTutorialMsg(player, " ");
- _tutorial._manager.sendTutorialMsg(player, C.cWhite + _finishMessage.replace("{", C.cAqua).replace("}", C.cWhite));
+ _tutorial._manager.sendTutorialMsg(player, C.cWhite + finishMessage);
_tutorial._manager.sendTutorialMsg(player, " ");
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
}
@@ -201,7 +253,6 @@ public class TutorialTask implements Listener
public void cleanup(Player player)
{
_inTask.remove(player.getName());
- _playersFinished.remove(player.getName());
}
public long getDescriptionWaitTime()
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskClaim.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskClaim.java
index a3c936754..23edfed24 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskClaim.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskClaim.java
@@ -21,7 +21,7 @@ public class TaskClaim extends TutorialTask
+ "Once claimed, only your Clan can break/place blocks here. "
+ "This is the perfect place to build a base and stash your items! "
+ "You can only claim in the Wilderness, and not next to other Clan's Territory. "
- + "To claim some territory, go into the Clans GUI by typing {/c} and {Left-Clicking}";
+ + "To claim some territory, go into the Clans GUI by typing {/c} and {Left-Clicking} the Territory button. (Looks like a flag)";
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskCustomizeClass.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskCustomizeClass.java
index ea7d0c3a6..91f065320 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskCustomizeClass.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskCustomizeClass.java
@@ -48,7 +48,14 @@ public class TaskCustomizeClass extends TutorialTask
if (clientclass != null && clientclass.GetSavingCustomBuild() != null && clientclass.GetSavingCustomBuild().AxeSkill != null)
{
finishFor(player);
+ iterator.remove();
}
}
}
+
+ @Override
+ public void cleanup(Player player)
+ {
+ // handled in onUpdate
+ }
}
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskDisbandClan.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskDisbandClan.java
index 69ca5de33..a294434cb 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskDisbandClan.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskDisbandClan.java
@@ -25,18 +25,6 @@ public class TaskDisbandClan extends TutorialTask
@Override
public void customStartFor(final Player player)
{
- if (_tutorial.get(player).InClanOnStart)
- {
- UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getManager().getPlugin(), new Runnable(){
- public void run()
- {
- if (isDoing(player))
- {
- finishFor(player);
- }
- }
- }, 6 * 20);
- }
}
@EventHandler
@@ -46,6 +34,8 @@ public class TaskDisbandClan extends TutorialTask
{
return;
}
+
+ System.out.println("COMPLETE DISBAND CLAN!");
finishFor(event.getDisbander());
}
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskEquipClass.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskEquipClass.java
index 01584fd32..458e04bb4 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskEquipClass.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskEquipClass.java
@@ -29,6 +29,12 @@ public class TaskEquipClass extends TutorialTask
+ "Purchase Iron Armor from the PvP Shop. "
+ "Then put on your armor to equip the Knight Class.";
+// _subtasks = new String[] {
+// "Open the PvP Shop",
+// "Buy Iron Armor Set",
+// "Equip Iron Armor"
+// };
+
_taskPos = new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f);
}
@@ -56,6 +62,11 @@ public class TaskEquipClass extends TutorialTask
public void customStartFor(Player player)
{
_bought.put(player.getName(), new NautArrayList());
+
+ if (getClans().getClassManager().Get(player).GetGameClass() != null)
+ {
+ finishFor(player);
+ }
}
@EventHandler
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskExploreShops.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskExploreShops.java
index 39ddfd126..d34c2129e 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskExploreShops.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskExploreShops.java
@@ -57,12 +57,19 @@ public class TaskExploreShops extends TutorialTask
if (ClansManager.getInstance().getClan(event.getPlayer()).getEnergyPurchasable() == 0)
{
finishFor(event.getPlayer());
+ _inTask.remove(event.getPlayer().getName());
return;
}
event.setFree(true);
}
-
+
+ @Override
+ public void cleanup(Player player)
+ {
+ // handled in on update
+ }
+
@EventHandler
public void onUpdate(UpdateEvent event)
{
@@ -78,6 +85,7 @@ public class TaskExploreShops extends TutorialTask
if (ClansManager.getInstance().getClan(player).getEnergy() == ClansManager.getInstance().getClan(player).getEnergyMax())
{
finishFor(player);
+ iterator.remove();
}
}
}
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskLeaveSpawn.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskLeaveSpawn.java
index 71a8155da..5f0f7926c 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskLeaveSpawn.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskLeaveSpawn.java
@@ -6,6 +6,8 @@ import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
+import mineplex.core.common.util.UtilPlayer;
+import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.tutorials.TutorialTask;
@@ -31,6 +33,7 @@ public class TaskLeaveSpawn extends TutorialTask
if (player.getLocation().getY() < 100)
{
finishFor(player);
+ _inTask.remove(player.getName());
}
}
@@ -45,12 +48,20 @@ public class TaskLeaveSpawn extends TutorialTask
Iterator iterator = _inTask.iterator();
while (iterator.hasNext())
{
- Player player = Bukkit.getPlayer(iterator.next());
+ String playerName = iterator.next();
+ Player player = UtilPlayer.searchExact(playerName);
- if (player.getLocation().getY() < 100 && getClans().getClanUtility().getClaim(player.getLocation()) == null)
+ if (player != null && player.getLocation().getY() < 100 && getClans().getClanUtility().getClaim(player.getLocation()) == null)
{
finishFor(player);
+ iterator.remove();
}
}
}
+
+ @Override
+ public void cleanup(Player player)
+ {
+ // We handle this in update() to avoid ConcurrentModificationException
+ }
}
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskMakingMoney.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskMakingMoney.java
index 3aefb2ab7..6ff1d9b4e 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskMakingMoney.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskMakingMoney.java
@@ -34,7 +34,7 @@ public class TaskMakingMoney extends TutorialTask
@Override
public void customStartFor(Player player)
{
- player.getInventory().addItem(new ItemStack(Material.CARROT, 1));
+ player.getInventory().addItem(new ItemStack(Material.CARROT_ITEM, 1));
}
@EventHandler
@@ -45,7 +45,7 @@ public class TaskMakingMoney extends TutorialTask
return;
}
- if (!event.getItem().getType().equals(Material.CARROT))
+ if (!event.getItem().getType().equals(Material.CARROT_ITEM))
{
return;
}
@@ -61,15 +61,12 @@ public class TaskMakingMoney extends TutorialTask
return;
}
- if (!ClansManager.getInstance().isInClan(event.getPlayer()))
- {
- return;
- }
-
if (!event.getItem().getType().equals(Material.CARROT_ITEM))
{
return;
}
+
+ System.out.println("FINISH CARROT");
finishFor(event.getPlayer());
}
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskUseAbility.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskUseAbility.java
index 58c9bb58d..c94324660 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskUseAbility.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskUseAbility.java
@@ -9,14 +9,18 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
+import org.bukkit.event.block.Action;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryType;
+import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.CraftingInventory;
+import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.NautArrayList;
import mineplex.core.common.util.NautHashMap;
+import mineplex.core.common.util.UtilServer;
import mineplex.core.task.TaskManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@@ -49,7 +53,6 @@ public class TaskUseAbility extends TutorialTask
public void customStartFor(Player player)
{
_bought.put(player.getName(), new NautArrayList());
- _teleported.put(player.getName(), false);
}
@Override
@@ -70,7 +73,7 @@ public class TaskUseAbility extends TutorialTask
{
Player _player = Bukkit.getPlayer(iterator.next());
- if (!_teleported.get(_player.getName()) && _player != null && _player.isOnline() && _player.getOpenInventory().getType() == InventoryType.CRAFTING)
+ if (!_teleported.containsKey(_player.getName()) && _player != null && _player.isOnline() && _player.getOpenInventory().getType() == InventoryType.CRAFTING)
{
_player.teleport(new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f));
_teleported.put(_player.getName(), true);
@@ -78,6 +81,7 @@ public class TaskUseAbility extends TutorialTask
}
}
+ /*
@EventHandler
public void onAbilityUesd(SkillTriggerEvent event)
{
@@ -88,6 +92,25 @@ public class TaskUseAbility extends TutorialTask
finishFor(event.GetPlayer());
}
+ */
+
+ @EventHandler
+ public void onRightClick(PlayerInteractEvent event)
+ {
+ Player player = event.getPlayer();
+
+ if (!isDoing(player))
+ return;
+
+ if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)
+ {
+ ItemStack item = player.getItemInHand();
+ if (item != null && item.getType() == Material.IRON_AXE)
+ {
+ finishFor(player);
+ }
+ }
+ }
@EventHandler
public void button(ClansShopAddButtonEvent event)
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskViewClanDetails.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskViewClanDetails.java
index 60e732340..9ece47104 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskViewClanDetails.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TaskViewClanDetails.java
@@ -16,7 +16,7 @@ public class TaskViewClanDetails extends TutorialTask
_technicalName = "CommandClanX";
_description = "Now you can view information about your clan. "
- + "To do this type {/c [clan name]}! "
+ + "To do this type {/c (clan)}! "
+ "You can also use any clan's name to get some information about them as well.";
}
diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TutorialGettingStarted.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TutorialGettingStarted.java
index 0fe1fc7fd..fe2dde3df 100644
--- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TutorialGettingStarted.java
+++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/gettingstarted/TutorialGettingStarted.java
@@ -25,7 +25,7 @@ public class TutorialGettingStarted extends Tutorial
// addTask(new TaskWelcome(this, 1));
- int id = 0;
+ int id = -1;
addTask(new TaskCreateClan(this, ++id));
addTask(new TaskViewClanDetails(this, ++id));
addTask(new TaskLeaveSpawn(this, ++id));
@@ -49,6 +49,13 @@ public class TutorialGettingStarted extends Tutorial
@Override
public void onFinished(final Player player)
+ {
+ player.resetPlayerTime();
+ player.teleport(Spawn.getEastSpawn());
+ }
+
+ @Override
+ protected void onFinishedDelay(Player player)
{
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
_manager.sendTutorialMsg(player, C.cYellowB + "CONGRATULATIONS");
@@ -56,11 +63,8 @@ public class TutorialGettingStarted extends Tutorial
_manager.sendTutorialMsg(player, C.cWhite + "You have completed the Clans basic tutorial and have been awarded " + C.cAqua + "30,000 Gold");
_manager.sendTutorialMsg(player, C.cWhite + "You can now begin your adventure, but do take a moment to read the signs around spawn for more information!");
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
-
- player.resetPlayerTime();
- player.teleport(Spawn.getEastSpawn());
}
-
+
@Override
public void onBegin(final Player player)
{
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java
index 4008f1b63..4b56eff02 100644
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java
+++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java
@@ -22,9 +22,7 @@ public class HubClient
public int DisplayLength = 16;
private int _lastGemCount = 0;
-
- private int _lastCoinCount = 0;
-
+
public HubClient(String name)
{
ScoreboardString = " Welcome " + name + ", to the Mineplex Network!";
@@ -133,14 +131,4 @@ public class HubClient
return display;
}
-
- public void SetLastCoinCount(int coins)
- {
- _lastCoinCount = coins;
- }
-
- public int GetLastCoinCount()
- {
- return _lastCoinCount;
- }
}
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java
index 4e16d3376..2dd2823cb 100644
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java
+++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java
@@ -1,7 +1,13 @@
package mineplex.hub;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.nio.file.Files;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Random;
import mineplex.core.MiniClientPlugin;
import mineplex.core.account.CoreClient;
@@ -21,6 +27,7 @@ import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
+import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.cosmetic.CosmeticManager;
@@ -28,12 +35,19 @@ import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseSlime;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.GadgetManager;
+import mineplex.core.gadget.event.GadgetActivateEvent;
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
+import mineplex.core.gadget.types.GadgetType;
import mineplex.core.giveaway.GiveawayManager;
import mineplex.core.hologram.HologramManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.message.PrivateMessageEvent;
import mineplex.core.mount.MountManager;
+import mineplex.core.noteblock.INoteVerifier;
+import mineplex.core.noteblock.NBSReader;
+import mineplex.core.noteblock.NotePlayer;
+import mineplex.core.noteblock.NoteSong;
+import mineplex.core.noteblock.event.SongFinishEvent;
import mineplex.core.notifier.NotificationManager;
import mineplex.core.npc.NpcManager;
import mineplex.core.packethandler.PacketHandler;
@@ -152,13 +166,19 @@ public class HubManager extends MiniClientPlugin
private HashMap _scoreboards = new HashMap();
private String _serverName = "";
-
+ private int _lastPlayerCount = 0;
private boolean _shuttingDown;
private HashMap _portalTime = new HashMap();
private HashMap> _creativeAdmin = new HashMap>();
+ // Christmas Songs
+ private Random _random = new Random();
+ private int _lastSong = 0;
+// private final String[] _songNames = {"JingleBells.nbs", "TheFirstNoel.nbs", "Hark.nbs", "DeckTheHalls.nbs", "Joy.nbs", "MerryChristmas.nbs"};
+ private final ArrayList _songs;
+
public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager, GiveawayManager giveawayManager)
{
super("Hub Manager", plugin);
@@ -214,12 +234,11 @@ public class HubManager extends MiniClientPlugin
_achievementManager.setGiveInterfaceItem(true);
_packetHandler = packetHandler;
- new NotificationManager(getPlugin(), clientManager);
+ new NotificationManager(getPlugin(), clientManager, preferences);
new BotSpamManager(plugin, clientManager, punish);
((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true;
-
new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, giveawayManager);
// _halloweenManager = new HalloweenSpookinessManager(this);
@@ -227,10 +246,70 @@ public class HubManager extends MiniClientPlugin
// NotificationManager notificationManager = new NotificationManager(plugin, clientManager, donationManager);
// new MailManager(_plugin, notificationManager);
+ _songs = new ArrayList();
+
+ try
+ {
+
+ File songsFolder = new File("../../update/songs/");
+ if (songsFolder.exists())
+ {
+ File[] files = songsFolder.listFiles();
+
+ for (File file : files)
+ {
+ if (file.getName().endsWith(".nbs"))
+ {
+ System.out.println("Loading Song " + file.getPath());
+ NoteSong song = NBSReader.loadSong(new DataInputStream(new FileInputStream(file)), file.getName().replace("_", " ").replace(".nbs", ""));
+ if (song != null)
+ {
+ _songs.add(song);
+ }
+ }
+ }
+ }
+ }
+ catch (FileNotFoundException e)
+ {
+ e.printStackTrace();
+ System.out.println("FAILED TO LOAD SONG!!");
+ }
+
+ playNextSong();
+
_serverName = getPlugin().getConfig().getString("serverstatus.name");
_serverName = _serverName.substring(0, Math.min(16, _serverName.length()));
}
+ private void playNextSong()
+ {
+ if (_songs.isEmpty())
+ return;
+
+ int index = (_lastSong + _random.nextInt(_songs.size() - 1)) % _songs.size();
+ NoteSong song = _songs.get(index);
+ if (song != null)
+ {
+ for (Player player : UtilServer.getPlayers())
+ {
+ if (_preferences.Get(player).HubMusic)
+ {
+ UtilTextBottom.display(C.cWhite + "Now Playing " + C.cYellow + song.getName(), player);
+ }
+ }
+
+ new NotePlayer(_plugin, song, new INoteVerifier()
+ {
+ @Override
+ public boolean shouldPlay(Player player)
+ {
+ return _preferences.Get(player).HubMusic;
+ }
+ }, 0.5F, false);
+ }
+ }
+
@Override
public void addCommands()
{
@@ -649,15 +728,14 @@ public class HubManager extends MiniClientPlugin
//Space
obj.getScore(" ").setScore(line--);
- //Coins
- obj.getScore(C.cYellow + C.Bold + "Coins").setScore(line--);
+ //Players
+ obj.getScore(C.cYellow + C.Bold + "Players").setScore(line--);
- // Remove Old
- player.getScoreboard().resetScores(Get(player.getName()).GetLastCoinCount() + "");
- // Add New
- obj.getScore(GetDonation().Get(player.getName()).getCoins() + "").setScore(line--);
-
- Get(player.getName()).SetLastCoinCount(GetDonation().Get(player.getName()).getCoins());
+ player.getScoreboard().resetScores(_lastPlayerCount + "");
+
+ _lastPlayerCount++;
+
+ obj.getScore(_lastPlayerCount + "").setScore(line--);
//Space
@@ -927,4 +1005,20 @@ public class HubManager extends MiniClientPlugin
new GUIProfile(getPlugin(), event.getPlayer(), _preferences, _achievementManager, _personalServerManager).openInventory();;
}
+
+ @EventHandler
+ public void disableMusicChristmas(GadgetActivateEvent event)
+ {
+ if (event.getGadget() != null && event.getGadget().getGadgetType() == GadgetType.MusicDisc)
+ {
+ UtilPlayer.message(event.getPlayer(), F.main("Hub", "Music Discs are disabled right now!"));
+ event.setCancelled(true);
+ }
+ }
+
+ @EventHandler
+ public void onSongFinish(SongFinishEvent event)
+ {
+ playNextSong();
+ }
}
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java
index db7624cd9..1733a2fcc 100644
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java
+++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java
@@ -65,7 +65,7 @@ public class HubVisibilityManager extends MiniPlugin
{
boolean hideMe = Manager.GetTutorial().InTutorial(player) ||
UtilMath.offset2d(player.getLocation(), Manager.GetSpawn()) == 0 ||
- Manager.getPreferences().Get(player).Invisibility ||
+ (Manager.getPreferences().Get(player).Invisibility && Manager.GetClients().Get(player).GetRank().has(Rank.MODERATOR)) ||
_hiddenPlayers.contains(player);
for (Player other : UtilServer.getPlayers())
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java
index 943acdd63..5287b1d76 100644
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java
+++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java
@@ -258,7 +258,44 @@ public class NewsManager extends MiniPlugin
String text = "";
double healthPercent = 1;
- if (Manager.Type == HubType.Halloween)
+ if (Manager.Type == HubType.Christmas)
+ {
+ _animationIndex = (_animationIndex + 1) % 40;
+
+ if (_animationIndex == 0) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 5" + C.cWhiteB + "0% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 1) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50" + C.cWhiteB + "% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 2) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% " + C.cWhiteB + "OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 3) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% O" + C.cWhiteB + "FF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 4) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OF" + C.cWhiteB + "F ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 5) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF " + C.cWhiteB + "ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 6) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF A" + C.cWhiteB + "LL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 7) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF AL" + C.cWhiteB + "L RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 8) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL " + C.cWhiteB + "RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 9) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL R" + C.cWhiteB + "ANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 10) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RA" + C.cWhiteB + "NKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 11) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RAN" + C.cWhiteB + "KS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 12) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANK" + C.cWhiteB + "S " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 13) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+
+ if (_animationIndex == 14) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 15) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 16) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 17) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 18) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 19) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 20) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 21) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 22) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 23) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 24) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 25) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 26) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+
+ if (_animationIndex >= 27)
+ text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " " + C.cWhiteB + "50% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+
+ }
+ else if (Manager.Type == HubType.Halloween)
{
/**
* @author Mysticate
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java
index 3cafbb8bf..4e3bc8320 100644
--- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java
+++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java
@@ -14,12 +14,14 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.hub.server.ServerManager;
+import mineplex.hub.server.ui.button.SelectBHButton;
import mineplex.hub.server.ui.button.SelectBLDButton;
import mineplex.hub.server.ui.button.SelectBRButton;
import mineplex.hub.server.ui.button.SelectCSButton;
import mineplex.hub.server.ui.button.SelectDMTButton;
import mineplex.hub.server.ui.button.SelectDOMButton;
import mineplex.hub.server.ui.button.SelectMINButton;
+import mineplex.hub.server.ui.button.SelectMSButton;
import mineplex.hub.server.ui.button.SelectPLAYERButton;
import mineplex.hub.server.ui.button.SelectSGButton;
import mineplex.hub.server.ui.button.SelectSKYButton;
@@ -193,9 +195,9 @@ public class ServerGameMenu extends ShopPageBase
getButtonMap().put(8, new SelectWIZButton(this));
getButtonMap().put(18, new SelectCSButton(this));
-// getButtonMap().put(20, new SelectBHButton(this));
+ getButtonMap().put(20, new SelectBHButton(this));
getButtonMap().put(22, new SelectSSMButton(this));
-// getButtonMap().put(24, new SelectMSButton(this));
+ getButtonMap().put(24, new SelectMSButton(this));
getButtonMap().put(26, new SelectDMTButton(this));
getButtonMap().put(36, new SelectDOMButton(this));
getButtonMap().put(38, new SelectTDMButton(this));
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectBHButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectBHButton.java
new file mode 100644
index 000000000..fea9423b6
--- /dev/null
+++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectBHButton.java
@@ -0,0 +1,23 @@
+package mineplex.hub.server.ui.button;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.ClickType;
+
+import mineplex.core.shop.item.IButton;
+import mineplex.hub.server.ui.ServerGameMenu;
+
+public class SelectBHButton implements IButton
+{
+ private ServerGameMenu _menu;
+
+ public SelectBHButton(ServerGameMenu menu)
+ {
+ _menu = menu;
+ }
+
+ @Override
+ public void onClick(Player player, ClickType clickType)
+ {
+ _menu.OpenBH(player);
+ }
+}
diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectMSButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectMSButton.java
new file mode 100644
index 000000000..ca500cb25
--- /dev/null
+++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectMSButton.java
@@ -0,0 +1,23 @@
+package mineplex.hub.server.ui.button;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.ClickType;
+
+import mineplex.core.shop.item.IButton;
+import mineplex.hub.server.ui.ServerGameMenu;
+
+public class SelectMSButton implements IButton
+{
+ private ServerGameMenu _menu;
+
+ public SelectMSButton(ServerGameMenu menu)
+ {
+ _menu = menu;
+ }
+
+ @Override
+ public void onClick(Player player, ClickType clickType)
+ {
+ _menu.openMS(player);
+ }
+}
diff --git a/Plugins/Nautilus.Game.Arcade/.classpath b/Plugins/Nautilus.Game.Arcade/.classpath
index 0c832983c..315ba497a 100644
--- a/Plugins/Nautilus.Game.Arcade/.classpath
+++ b/Plugins/Nautilus.Game.Arcade/.classpath
@@ -1,7 +1,7 @@
-
+
diff --git a/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.core.prefs b/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.core.prefs
index 70732762e..bfbbfb4d1 100644
--- a/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.core.prefs
+++ b/Plugins/Nautilus.Game.Arcade/.settings/org.eclipse.jdt.core.prefs
@@ -1,14 +1,14 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
+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.7
+org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=next_line
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java
index a29c226fe..fbf22d621 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java
@@ -59,6 +59,7 @@ import mineplex.core.status.ServerStatusManager;
import mineplex.core.task.TaskManager;
import mineplex.core.teleport.Teleport;
import mineplex.core.timing.TimingManager;
+import mineplex.core.titangiveaway.TitanGiveawayManager;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.ClassManager;
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
@@ -101,6 +102,7 @@ import nautilus.game.arcade.managers.GameSpectatorManager;
import nautilus.game.arcade.managers.GameStatManager;
import nautilus.game.arcade.managers.GameTournamentManager;
import nautilus.game.arcade.managers.GameWorldManager;
+import nautilus.game.arcade.managers.HolidayManager;
import nautilus.game.arcade.managers.IdleManager;
import nautilus.game.arcade.managers.MiscManager;
import nautilus.game.arcade.shop.ArcadeShop;
@@ -298,16 +300,14 @@ public class ArcadeManager extends MiniPlugin implements IRelation
new MiscManager(this);
_hologramManager = hologramManager;
_idleManager = new IdleManager(this);
- //TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager);
- //new HolidayManager(this, titanGiveaway);
+ TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager);
+ new HolidayManager(this, titanGiveaway);
// Game Addons
new CompassAddon(plugin, this);
new SoupAddon(plugin, this);
new TeamArmorAddon(plugin, this);
- new NotificationManager(getPlugin(), clientManager);
-
new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, giveawayManager);
//Champions Modules
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java
index c89ac87cd..144aa8181 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java
@@ -36,6 +36,7 @@ import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.hanging.HangingBreakEvent;
import org.bukkit.event.hanging.HangingPlaceEvent;
+import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@@ -1728,4 +1729,21 @@ public abstract class Game implements Listener
}
}
}
+
+ @EventHandler
+ public void debug(PlayerCommandPreprocessEvent event)
+ {
+ if (event.getMessage().equals("/debugteams"))
+ {
+ for (GameTeam team : GetTeamList())
+ {
+ event.getPlayer().sendMessage(team.GetFormattedName());
+
+ for (Player player : team.GetPlayers(false))
+ {
+ event.getPlayer().sendMessage(player.getName() + ": " + team.IsAlive(player));
+ }
+ }
+ }
+ }
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java
index ddbd4f68c..7d8264b88 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java
@@ -79,7 +79,7 @@ public class GameTeam
{
Host = host;
- _displayName = name;
+ _displayName = null;
_name = name;
_color = color;
_spawns = spawns;
@@ -178,7 +178,7 @@ public class GameTeam
{
_players.put(player, in ? PlayerState.IN : PlayerState.OUT);
- UtilPlayer.message(player, F.main("Team", _color + C.Bold + "You joined " + _displayName + " Team."));
+ UtilPlayer.message(player, F.main("Team", _color + C.Bold + "You joined " + getDisplayName() + " Team."));
VisibilityManager.Instance.refreshPlayerToAll(player);
}
@@ -192,7 +192,7 @@ public class GameTeam
other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name + _name.toUpperCase()).removePlayer(player);
other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name).addPlayer(player);
}
- UtilPlayer.message(player, F.main("Team", _color + C.Bold + _displayName + " Team was disbanded."));
+ UtilPlayer.message(player, F.main("Team", _color + C.Bold + getDisplayName() + " Team was disbanded."));
}
_players.clear();
@@ -323,6 +323,9 @@ public class GameTeam
public String getDisplayName()
{
+ if (_displayName == null)
+ return _name;
+
return _displayName;
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java
index c2a457899..a066fd174 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java
@@ -118,6 +118,7 @@ public class Build extends SoloGame
private int _countdownTimerState = 0;
private String[] _words;
+ private String[] _holidayWords;
private String _word = "?";
@@ -140,20 +141,20 @@ public class Build extends SoloGame
private ChatColor _hintColor = ChatColor.YELLOW;
private ChatColor _firstHintColor = ChatColor.YELLOW;
- public Build(ArcadeManager manager)
+ public Build(ArcadeManager manager)
{
super(manager, GameType.Build,
new Kit[]
{
- new KitBuilder(manager),
+ new KitBuilder(manager),
},
- new String[]
- {
- "Be creative and build something",
- "based on the build theme!"
- });
+ new String[]
+ {
+ "Be creative and build something",
+ "based on the build theme!"
+ });
this.StrictAntiHack = true;
this.Damage = false;
@@ -161,7 +162,7 @@ public class Build extends SoloGame
this.HealthSet = 20;
this.BlockBreak = true;
- this.BlockPlace = true;
+ this.BlockPlace = true;
this.ItemDrop = true;
this.ItemPickup = true;
@@ -173,32 +174,42 @@ public class Build extends SoloGame
this.PrepareFreeze = false;
this.CreatureAllow = true;
-
+
this.WorldFireSpread = true;
this.WorldBoneMeal = true;
-
+
this.DontAllowOverfill = true;
-
+
UtilServer.getServer().spigot().getConfig().set("view-distance", 4);
_words = new String[]
{
- "Rollercoaster", "Pokemon", "Pirates", "Vikings", "Dinosaur", "Dragon", "Toilet", "Farm", "Tree House",
- "Cat", "Truck", "Bicycle", "Soda", "Music Instrument", "Statue", "Pot of Gold", "Shrek", "Fruit", "Breakfast",
- "Toaster", "Robot", "Camping", "Rocket", "Aliens", "Shipwreck", "Spongebob", "Car", "Potted Plant", "Weapons",
- "Christmas", "King", "Queen", "Angel", "Demon", "Halloween", "Tank", "Helicopter", "Knight", "Rabbit",
- "Sandwich", "Snowman", "Ice Cream", "Sea Shell", "Rainbow",
- "Volcano", "Hot Tub", "Octopus", "Ghost", "Ant", "Cheese", "Kite Flying", "Reptile",
- "Space Ship", "Pixel Art", "Chicken", "Shoe", "Owl", "Bear", "Flowers", "Lighthouse",
- "Lion", "Television", "Batman", "Tiger", "Castle", "House",
- "Bed", "Party", "Volleyball", "Toys", "Library", "Love", "Skull",
- "Hat", "Snake", "Vacation", "Umbrella", "Magic", "Tornado", "Candy", "Dentist", "Pizza", "Bird",
- "Superhero", "Turtle", "Chicken", "Build Anything!", "Food", "Picnic",
- "Trophy", "Pool Party", "Hot Air Balloon", "Train", "Chocolate Bar",
- "Clown", "Windmill", "Alligator",
- "Police", "Igloo", "Gift", "Bumblebee", "Jellyfish", "Speedboat",
- "Fall", "Summer", "Autumn", "Winter", "Disco", "Moose",
- "Water Gun", "Astronaut", "Wither", "Meteor"
+ "Rollercoaster", "Pokemon", "Pirates", "Vikings", "Dinosaur", "Dragon", "Toilet", "Farm", "Tree House",
+ "Cat", "Truck", "Bicycle", "Soda", "Music Instrument", "Statue", "Pot of Gold", "Shrek", "Fruit", "Breakfast",
+ "Toaster", "Robot", "Camping", "Rocket", "Aliens", "Shipwreck", "Spongebob", "Car", "Potted Plant", "Weapons",
+ "Christmas", "King", "Queen", "Angel", "Demon", "Halloween", "Tank", "Helicopter", "Knight", "Rabbit",
+ "Sandwich", "Snowman", "Ice Cream", "Sea Shell", "Rainbow",
+ "Volcano", "Hot Tub", "Octopus", "Ghost", "Ant", "Cheese", "Kite Flying", "Reptile",
+ "Space Ship", "Pixel Art", "Chicken", "Shoe", "Owl", "Bear", "Flowers", "Lighthouse",
+ "Lion", "Television", "Batman", "Tiger", "Castle", "House",
+ "Bed", "Party", "Volleyball", "Toys", "Library", "Love", "Skull",
+ "Hat", "Snake", "Vacation", "Umbrella", "Magic", "Tornado", "Candy", "Dentist", "Pizza", "Bird",
+ "Superhero", "Turtle", "Chicken", "Build Anything!", "Food", "Picnic",
+ "Trophy", "Pool Party", "Hot Air Balloon", "Train", "Chocolate Bar",
+ "Clown", "Windmill", "Alligator",
+ "Police", "Igloo", "Gift", "Bumblebee", "Jellyfish", "Speedboat",
+ "Fall", "Summer", "Autumn", "Winter", "Disco", "Moose",
+ "Water Gun", "Astronaut", "Wither", "Meteor"
+ };
+
+ _holidayWords = new String[]
+ {
+ "Santa", "Reindeer", "Ornament", "Elf", "North Pole", "Candy Cane", "Xmas Lights", "Christmas Tree",
+ "Fireplace", "Hot Chocolate", "Snowflake", "Snowman", "Sleigh", "Toys", "Milk", "Eggnog", "Coal",
+ "Cookies", "Mistletoe", "Icicle", "Gingerbread", "Stocking", "Jingle Bells", "Family", "Mittens",
+ "Snowball Fight", "Decorations", "Snow Fort", "Chimney", "Scrooge", "Sweater", "Ice Skating",
+ "Pinecone", "Cabin", "Bells", "Cold", "Nutcracker", "Sled", "Mrs. Claus", "Grinch", "Igloo",
+ "Boots", "Gingerbread Man", "Glacier", "Ice Hockey", "Scarf", "Snowboard"
};
_mobShop = new MobShop(getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation());
@@ -238,7 +249,10 @@ public class Build extends SoloGame
player.setFlySpeed(0.1f);
}
- _word = _words[UtilMath.r(_words.length)];
+ if (Math.random() >= 0.5)
+ _word = _words[UtilMath.r(_words.length)];
+ else
+ _word = _holidayWords[UtilMath.r(_holidayWords.length)];
UtilTextMiddle.display(null, C.cYellow + "Build " + C.cWhite + _word, 0, 80, 5);
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java
index 24cd6996f..53d88aeda 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java
@@ -83,6 +83,7 @@ public class Draw extends SoloGame
private HashSet _tools;
private String[] _words;
+ private String[] _holidayWords;
private HashSet _usedWords = new HashSet();
public Draw(ArcadeManager manager)
@@ -113,6 +114,16 @@ public class Draw extends SoloGame
"Bird", "Volcano", "Sloth", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat", "Beard", "Wind", "Rain", "Minecraft", "Push", "Fighting", "Juggle", "Clown", "Miner", "Creeper", "Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Pregnant", "Photo", "Quick", "Mario", "Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet", "Mountain Bike", "Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi", "Shotgun", "Pistol", "James Bond", "Money", "Salt and Pepper", "Truck", "Helicopter", "Hot Air Balloon", "Sprout", "Yelling", "Muscles", "Skinny", "Zombie", "Lava", "Snake", "Motorbike", "Whale", "Boat", "Letterbox", "Window", "Lollipop", "Handcuffs", "Police", "Uppercut", "Windmill", "Eyepatch", "Campfire", "Rainbow", "Storm", "Pikachu", "Charmander", "Tornado", "Crying", "King", "Hobo", "Worm", "Snail", "XBox", "Playstation", "Nintendo", "Duck", "Pull", "Dinosaur", "Alligator", "Ankle", "Angel", "Acorn", "Bread", "Booty", "Bacon", "Crown", "Donut", "Drill", "Leash", "Magic", "Wizard", "Igloo", "Plant", "Screw", "Rifle", "Puppy", "Stool", "Stamp", "Letter", "Witch", "Zebra", "Wagon", "Compass", "Watch", "Clock", "Time", "Cyclops", "Coconut", "Hang", "Penguin", "Confused", "Bucket", "Lion", "Rubbish", "Spaceship", "Bowl", "Shark", "Pizza", "Pyramid", "Dress", "Pants", "Shorts", "Boots", "Boy", "Girl", "Math", "Sunglasses", "Frog", "Chair", "Cake", "Grapes", "Kiss", "Snorlax", "Earth", "Spaghetti", "Couch", "Family", "Milk", "Blood", "Pig", "Giraffe", "Mouse", "Couch", "Fat", "Chocolate", "Camel", "Cheese", "Beans", "Water", "Chicken", "Cannibal", "Zipper", "Book", "Swimming", "Horse", "Paper", "Toaster", "Television", "Hammer", "Piano", "Sleeping", "Yawn", "Sheep", "Night", "Chest", "Lamp", "Redstone", "Grass", "Plane", "Ocean", "Lake", "Melon", "Pumpkin", "Gift", "Fishing", "Pirate", "Lightning", "Stomach", "Belly Button", "Fishing Rod", "Iron Ore", "Diamonds", "Emeralds", "Nether Portal", "Ender Dragon", "Rabbit", "Harry Potter", "Torch", "Light", "Battery", "Zombie Pigman", "Telephone", "Tent", "Hand", "Traffic Lights", "Anvil", "Tail", "Umbrella", "Piston", "Skeleton", "Spikes", "Bridge", "Bomb", "Spoon", "Rainbow", "Staircase", "Poop", "Dragon", "Fire", "Apple", "Shoe", "Squid", "Cookie", "Tooth", "Camera", "Sock", "Monkey", "Unicorn", "Smile", "Pool", "Rabbit", "Cupcake", "Pancake", "Princess", "Castle", "Flag", "Planet", "Stars", "Camp Fire", "Rose", "Spray", "Pencil", "Ice Cream", "Toilet", "Moose", "Bear", "Beer", "Batman", "Eggs", "Teapot", "Golf Club", "Tennis Racket", "Shield", "Crab", "Pot of Gold", "Cactus", "Television", "Pumpkin Pie", "Chimney", "Stable", "Nether", "Wither", "Beach", "Stop Sign", "Chestplate", "Pokeball", "Christmas Tree", "Present", "Snowflake", "Laptop", "Superman", "Football", "Basketball", "Creeper", "Tetris", "Jump", "Ninja", "Baby", "Troll Face", "Grim Reaper", "Temple", "Explosion", "Vomit", "Ants", "Barn", "Burn", "Baggage", "Frisbee", "Iceberg", "Sleeping", "Dream", "Snorlax", "Balloons", "Elevator", "Alligator", "Bikini", "Butterfly", "Bumblebee", "Pizza", "Jellyfish", "Sideburns", "Speedboat", "Treehouse", "Water Gun", "Drink", "Hook", "Dance", "Fall", "Summer", "Autumn", "Spring", "Winter", "Night Time", "Galaxy", "Sunrise", "Sunset", "Picnic", "Snowflake", "Holding Hands", "America", "Laptop", "Anvil", "Bagel", "Bench", "Cigar", "Darts", "Muffin", "Queen", "Wheat", "Dolphin", "Scarf", "Swing", "Thumb", "Tomato", "Alcohol", "Armor", "Alien", "Beans", "Cheek", "Phone", "Keyboard", "Orange", "Calculator", "Paper", "Desk", "Disco", "Elbow", "Drool", "Giant", "Golem", "Grave", "Llama", "Moose", "Party", "Panda", "Plumber", "Salsa", "Salad", "Skunk", "Skull", "Stump", "Sugar", "Ruler", "Bookcase", "Hamster", "Soup", "Teapot", "Towel", "Waist", "Archer", "Anchor", "Bamboo", "Branch", "Booger", "Carrot", "Cereal", "Coffee", "Wolf", "Crayon", "Finger", "Forest", "Hotdog", "Burger", "Obsidian", "Pillow", "Swing", "YouTube", "Farm", "Rain", "Cloud", "Frozen", "Garbage", "Music", "Twitter", "Facebook", "Santa Hat", "Rope", "Neck", "Sponge", "Sushi", "Noodles", "Soup", "Tower", "Berry", "Capture", "Prison", "Robot", "Trash", "School", "Skype", "Snowman", "Crowd", "Bank", "Mudkip", "Joker", "Lizard", "Tiger", "Royal", "Erupt", "Wizard", "Stain", "Cinema", "Notebook", "Blanket", "Paint", "Guard", "Astronaut" , "Slime" , "Mansion" , "Radar" , "Thorn" , "Tears" , "Tiny" , "Candy" , "Pepsi" , "Flint" , "Draw My Thing" , "Rice" , "Shout" , "Prize" , "Skirt" , "Thief" , "Syrup" , "Kirby" , "Brush" , "Violin", "Car", "Sun", "Eye", "Bow", "Axe", "Face", "Mushroom", "Guitar", "Book",
};
+ _holidayWords = new String[]
+ {
+ "Santa", "Reindeer", "Ornament", "Elf", "North Pole", "Candy Cane", "Christmas Tree",
+ "Fireplace", "Hot Chocolate", "Snowflake", "Snowman", "Sleigh", "Toys", "Milk", "Eggnog", "Coal",
+ "Cookies", "Mistletoe", "Icicle", "Gingerbread", "Stocking", "Jingle Bells", "Family", "Mittens",
+ "Snowball Fight", "Decorations", "Snow Fort", "Chimney", "Scrooge", "Sweater", "Ice Skating",
+ "Pinecone", "Cabin", "Bells", "Cold", "Nutcracker", "Sled", "Grinch", "Igloo",
+ "Boots", "Gingerbread Man", "Glacier", "Ice Hockey", "Scarf", "Snowboard"
+ };
+
_tools = new HashSet();
_tools.add(new ToolLine(this));
_tools.add(new ToolSquare(this));
@@ -282,12 +293,22 @@ public class Draw extends SoloGame
public String GetWord()
{
//Get Word
- String word = _words[UtilMath.r(_words.length)];
+ String word = getRandomWord();
while (!_usedWords.add(word))
- word = _words[UtilMath.r(_words.length)];
+ word = getRandomWord();
return word;
}
+
+ private String getRandomWord()
+ {
+ if (Math.random() >= 0.30)
+ {
+ return _words[UtilMath.r(_words.length)];
+ }
+
+ return _holidayWords[UtilMath.r(_holidayWords.length)];
+ }
@EventHandler(priority = EventPriority.LOWEST)
public void Guess(AsyncPlayerChatEvent event)
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java
index 31e1a164a..03499db01 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java
@@ -77,8 +77,6 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
-import com.sun.xml.internal.ws.resources.UtilMessages;
-
public class EventGame extends Game
{
private GameHostManager _mps;
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java
index 5b901bc62..65af10219 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java
@@ -30,8 +30,6 @@ import org.bukkit.entity.Projectile;
import org.bukkit.entity.Slime;
import org.bukkit.util.Vector;
-import sun.rmi.runtime.Log;
-
public class Ball
{
private MonsterLeague _host;
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java
index 20796f801..5f1c52111 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java
@@ -6,12 +6,11 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
-import mineplex.core.disguise.disguises.DisguiseEnderman;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.game.games.monsterleague.perks.PerkBlinkMonsterLeague;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
-import nautilus.game.arcade.kit.perks.PerkBlink;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class KitEnderman extends LeagueKit
@@ -28,7 +27,7 @@ public class KitEnderman extends LeagueKit
new Perk[]
{
new PerkDoubleJump("Double Jump", 1, 1, true),
- new PerkBlink("Blink", 32, 16000),
+ new PerkBlinkMonsterLeague("Blink", 32, 16000),
},
EntityType.ENDERMAN,
new ItemStack(Material.AIR), 1.4);
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitGolem.java
index 9427e6ef2..2024c10bd 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitGolem.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitGolem.java
@@ -29,7 +29,7 @@ public class KitGolem extends LeagueKit
new Perk[]
{
new PerkDoubleJump("Double Jump", 0.8, 0.8, true),
- new PerkStoneWall(),
+ new PerkStoneWall("Iron Wall", Material.IRON_BLOCK, Material.IRON_INGOT),
new PerkSlow(0)
},
EntityType.IRON_GOLEM,
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlink.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlinkMonsterLeague.java
similarity index 94%
rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlink.java
rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlinkMonsterLeague.java
index 75e0654a9..de32a72e1 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlink.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlinkMonsterLeague.java
@@ -19,14 +19,15 @@ import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
+import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashPerk;
-public class PerkBlink extends SmashPerk
+public class PerkBlinkMonsterLeague extends Perk
{
private double _range = 32;
private long _recharge = 24000;
- public PerkBlink(String name, double range, long recharge)
+ public PerkBlinkMonsterLeague(String name, double range, long recharge)
{
super("Blink", new String[]
{
@@ -51,9 +52,6 @@ public class PerkBlink extends SmashPerk
return;
Player player = event.getPlayer();
-
- if (isSuperActive(player))
- return;
if (!Kit.HasKit(player))
return;
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkStoneWall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkStoneWall.java
index 90a678c6a..72f78fd0c 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkStoneWall.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkStoneWall.java
@@ -20,7 +20,9 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
+import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
+import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@@ -29,14 +31,19 @@ import nautilus.game.arcade.kit.perks.data.IcePathData;
public class PerkStoneWall extends Perk
{
- private HashSet _data = new HashSet();
+ private Material _type;
+ private Material _itemInHand;
- public PerkStoneWall()
+ public PerkStoneWall(String name, Material block, Material itemInHand)
{
- super("Iron Wall", new String[]
+ super(name, new String[]
{
- C.cYellow + "Click" + C.cGray + " to use " + C.cGreen + "Iron Wall"
+ C.cYellow + "Click" + C.cGray + " with " + ItemStackFactory.Instance.GetName(itemInHand, (byte)0, false) + " to use " + C.cGreen + name
});
+
+ _type = block;
+
+ _itemInHand = itemInHand;
}
@EventHandler
@@ -49,6 +56,9 @@ public class PerkStoneWall extends Perk
event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
+ if (!UtilGear.isMat(event.getPlayer().getItemInHand(), _itemInHand))
+ return;
+
if (UtilBlock.usable(event.getClickedBlock()))
return;
@@ -57,7 +67,7 @@ public class PerkStoneWall extends Perk
if (!Kit.HasKit(player))
return;
- if (!Recharge.Instance.use(player, GetName(), 24000, true, true))
+ if (!Recharge.Instance.use(player, GetName(), 20000, true, true))
return;
Recharge.Instance.setDisplayForce(player, GetName(), true);
@@ -98,9 +108,9 @@ public class PerkStoneWall extends Perk
loc.add(UtilAlg.getLeft(dir).multiply(i));
loc.add(UtilAlg.getUp(dir).multiply(j));
- Manager.GetBlockRestore().add(loc.getBlock(), Material.IRON_BLOCK.getId(), (byte)0, 4000);
+ Manager.GetBlockRestore().add(loc.getBlock(), _type.getId(), (byte)0, 4000);
- loc.getWorld().playEffect(loc, Effect.STEP_SOUND, Material.IRON_BLOCK);
+ loc.getWorld().playEffect(loc, Effect.STEP_SOUND, _type);
}
player.getWorld().playSound(player.getLocation(), Sound.IRONGOLEM_DEATH, 2f, 1f);
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java
index 59c1a8896..1cd250deb 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java
@@ -302,6 +302,11 @@ public class Runner extends SoloGame implements IThrown
{
return;
}
+
+ if (target.getLocation().getY() > data.GetThrown().getLocation().getY() + 0.5)
+ {
+ return;
+ }
}
//Damage Event
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java
index 755cfa69d..4ae1fcb33 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java
@@ -62,7 +62,7 @@ public class KitPig extends SmashKit
ChatColor.RESET + "dealing damage and knockback to enemies.",
ChatColor.RESET + "",
ChatColor.RESET + "Eat the bacon to restore some Energy.",
- ChatColor.RESET + "Bacon that hit an enemy will restore Health.",
+ ChatColor.RESET + "Bacon that hits an enemy will restore Health.",
}));
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java
index 79f51f53b..d398bba74 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java
@@ -87,7 +87,8 @@ public class PerkCowAngryHerd extends SmashPerk
loc.add(UtilAlg.getLeft(dir).multiply(i*1.5));
Manager.GetGame().CreatureAllowOverride = true;
- Cow cow = player.getWorld().spawn(loc, isSuperActive(player) ? MushroomCow.class : Cow.class);
+ Class extends Cow> clazz = isSuperActive(player) ? MushroomCow.class : Cow.class;
+ Cow cow = player.getWorld().spawn(loc, clazz);
Manager.GetGame().CreatureAllowOverride = false;
_active.add(new DataCowCharge(player, cow));
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java
index 492f82da9..cb278885d 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java
@@ -4,10 +4,16 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map.Entry;
+import java.util.Set;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
+import mineplex.core.common.util.UtilAction;
+import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
+import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
@@ -16,6 +22,7 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
+import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.updater.UpdateType;
@@ -56,6 +63,8 @@ import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
+import org.bukkit.event.player.PlayerCommandPreprocessEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.scheduler.BukkitRunnable;
@@ -64,263 +73,108 @@ import org.bukkit.util.Vector;
public class SnowFight extends TeamGame
{
+ private long _meteorTime = 360000;
+ private boolean _meteors = false;
- private HashMap _tiles;
- private boolean _meteors;
- private boolean _peace;
-
+ private HashSet _meteorSet = new HashSet();
+
public SnowFight(ArcadeManager manager)
{
super(manager, GameType.SnowFight,
- new Kit[]
+ new Kit[]
{
- new KitSportsman(manager),
- new KitTactician(manager),
- new KitMedic(manager)
+ new KitSportsman(manager),
+ new KitTactician(manager),
+ new KitMedic(manager)
},
new String[]
{
- "Defeat your foes with Snowballs",
- "Last team alive wins!"
+ "Defeat your foes with Snowballs",
+ "Last team alive wins!"
});
+ this.PrepareFreeze = false;
+
this.HungerSet = 20;
+
this.CompassEnabled = true;
this.CompassGiveItem = false;
+
this.TeamArmor = true;
this.TeamArmorHotbar = true;
- this.BlockPlace = true;
- this.BlockBreakAllow = new HashSet<>(Arrays.asList(Material.FENCE.getId()));
- this._tiles = new HashMap();
- this._meteors = false;
- this._peace = false;
+
+// this.WorldWeatherEnabled = true;
+// this.WorldTimeSet = 4000;
}
+// @EventHandler
+// public void weather(UpdateEvent event)
+// {
+// if (event.getType() != UpdateType.SEC)
+// return;
+//
+// WorldData.World.setStorm(true);
+// WorldData.World.setThundering(false);
+// WorldData.World.setWeatherDuration(12);
+// }
+
@EventHandler
- public void GameState(GameStateChangeEvent event)
+ public void battleAnnounce(GameStateChangeEvent event)
{
- if(event.GetState() != GameState.Live)
- return;
-
- this.Announce(C.cRed + C.Bold + "ALERT: " + ChatColor.RESET + C.Bold + "15 seconds Peace Phase is starting!");
- }
-
- @EventHandler
- public void Weather(UpdateEvent event)
- {
- if (event.getType() != UpdateType.SEC)
- return;
-
- World world = UtilWorld.getWorldType(Environment.NORMAL);
-
- if (world == null)
- return;
-
- world.setStorm(true);
- world.setThundering(false);
- world.setWeatherDuration(40);
- world.setTime(4000);
- }
-
- @EventHandler
- public void IceDamage(UpdateEvent event) {
- if(event.getType() != UpdateType.FAST)
- return;
-
- if(!IsLive())
- return;
-
- for(Player player : GetPlayers(true))
+ if (event.GetState() == GameState.Prepare)
{
- if(IsOnIce(player))
- {
- Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, null, DamageCause.CUSTOM, 2.0D, false, true, true, "Ice", "Ice", false));
- }
+ UtilTextMiddle.display(C.cGreen + "Prepare", "Collect Snowballs!", 0, 60, 20, UtilServer.getPlayers());
}
-
- }
-
- @EventHandler
- public void Meteor(UpdateEvent event)
- {
- if(event.getType() != UpdateType.FAST)
- return;
-
- if (!IsLive())
- return;
-
- if (System.currentTimeMillis() <= getGameLiveTime() + 10000)
- {
- UtilTextMiddle.display(C.cGreen + "Prepare", "Battle in " + UtilTime.MakeStr((getGameLiveTime() + 10000) - System.currentTimeMillis()), 0, 60, 20, UtilServer.getPlayers());
- return;
- }
-
- if (!_peace)
+ if (event.GetState() == GameState.Live)
{
for(Player player : GetPlayers(false))
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F);
-
- UtilTextMiddle.display(C.cRed + "FIGHT", "Throw your Snowballs!", 0, 60, 20, UtilServer.getPlayers());
- _peace = true;
+ UtilTextMiddle.display(C.cRed + "FIGHT", "", 0, 40, 20, UtilServer.getPlayers());
}
-
- if(System.currentTimeMillis() <= getGameLiveTime() + (195 * 1000))
- return;
-
- if(!_meteors)
- {
- for(Player player : GetPlayers(false))
- {
- player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F);
- UtilTextMiddle.display(C.cAqua + C.Bold + "Ice Meteors", "Avoid the Ice Fields!", player);
- }
-
- _meteors = true;
- }
- makeMeteor();
}
@EventHandler
- public void BlockDamage(BlockDamageEvent event)
+ public void blockDamage(PlayerInteractEvent event)
{
Player player = event.getPlayer();
- if (!IsLive())
+ if (!InProgress())
return;
- if (!IsPlaying(player))
+ if (!UtilEvent.isAction(event, ActionType.L_BLOCK))
return;
- if (!IsSnow(event.getBlock()))
+ if (!IsPlaying(player) || !IsAlive(player))
+ return;
+
+ if (!isSnow(event.getClickedBlock()))
return;
if (UtilInv.contains(player, Material.SNOW_BALL, (byte) 0, 16))
return;
- // Item
-
- if (!_tiles.containsKey(player))
- {
- _tiles.put(player, 0);
- }
-
- if (GetKit(player) instanceof KitSportsman)
- UtilInv.insert(player, new ItemStack(Material.SNOW_BALL));
-
-
- int tiles = _tiles.get(player);
- _tiles.put(player, tiles + 1);
-
- if (!(GetKit(player) instanceof KitSportsman))
- {
- if (_tiles.get(player) == 2)
- {
- UtilInv.insert(player, new ItemStack(Material.SNOW_BALL));
- _tiles.put(player, 0);
- }
- }
+ UtilInv.insert(player, new ItemStack(Material.SNOW_BALL));
// Snow Height
- SnowDecrease(event.getBlock(), 1);
+ snowDecrease(event.getClickedBlock(), 1);
// Effect
- event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, 80);
+ event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, 80);
}
- // @EventHandler
- // public void InteractSnowball(PlayerInteractEvent event)
- // {
- // Player player = event.getPlayer();
- //
- // if (!IsLive())
- // return;
- //
- // if (!IsPlaying(player))
- // return;
- //
- // if (!UtilGear.isMat(player.getItemInHand(), Material.SNOW_BALL))
- // return;
- //
- // event.setCancelled(true);
- //
- // if (UtilEvent.isAction(event, ActionType.L))
- // SnowballThrow(player);
- //
- // else if (UtilEvent.isAction(event, ActionType.R_BLOCK))
- // SnowballPlace(player, event.getClickedBlock(), 1);
- // }
- //
- // private void SnowballPlace(Player player, Block block, int above)
- // {
- // if (block.getTypeId() == 78 || UtilBlock.airFoliage(block))
- // {
- // //Build
- // if (block.getTypeId() == 78)
- // {
- // block.setTypeIdAndData(78, (byte)(block.getData() + 1), true);
- //
- // if (block.getData() >= 7)
- // block.setTypeIdAndData(80, (byte)0, true);
- // }
- // else
- // {
- // block.setTypeIdAndData(78, (byte)0, true);
- // }
- //
- // //Sound
- // block.getWorld().playSound(block.getLocation(), Sound.STEP_SNOW, 1f,
- // 0.6f);
- //
- // //Use Snow
- // SnowballCount(player, -1);
- // }
- // else if ((IsSnow(block) || UtilBlock.solid(block)) && above > 0)
- // {
- // SnowballPlace(player, block.getRelative(BlockFace.UP), above - 1);
- // }
- // }
- //
- // private void SnowballThrow(Player player)
- // {
- // //Throw
- // player.launchProjectile(Snowball.class);
- //
- // //Use Snow
- // SnowballCount(player, -1);
- //
- // //Sound
- // player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 3f,
- // 1.5f);
- // }
-
- // private void SnowballCount(Player player, int count)
- // {
- // if (player.getInventory().getItem(1) != null)
- // count += player.getInventory().getItem(1).getAmount();
- //
- // if (count > 16)
- // count = 16;
- //
- // if (count > 0)
- // player.getInventory().setItem(1,
- // ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL, count));
- // else
- // player.getInventory().setItem(1, null);
- // }
-
- private void SnowDecrease(Block block, int height)
+ private void snowDecrease(Block block, int height)
{
if (height <= 0)
return;
- if (!IsSnow(block))
+ if (!isSnow(block))
return;
// Shuffle Up
- while (IsSnow(block.getRelative(BlockFace.UP)))
+ while (isSnow(block.getRelative(BlockFace.UP)))
block = block.getRelative(BlockFace.UP);
// Snow Block
@@ -332,40 +186,33 @@ public class SnowFight extends TeamGame
if (height >= snowLevel)
{
block.setTypeIdAndData(0, (byte) 0, false);
- SnowDecrease(block.getRelative(BlockFace.DOWN), height - snowLevel);
+ snowDecrease(block.getRelative(BlockFace.DOWN), height - snowLevel);
}
else
{
block.setTypeIdAndData(78, (byte) (snowLevel - height - 1), false);
}
}
-
+
@EventHandler
- public void HealthRegen(EntityRegainHealthEvent event)
+ public void healthRegen(EntityRegainHealthEvent event)
{
if(event.getRegainReason() == RegainReason.SATIATED)
{
event.setAmount(1);
}
}
-
+
@EventHandler(priority = EventPriority.HIGH)
- public void GenerallDamage(CustomDamageEvent event)
+ public void generallDamage(CustomDamageEvent event)
{
if(event.GetCause() == DamageCause.ENTITY_ATTACK)
event.SetCancelled("No Melee");
}
- @EventHandler(priority = EventPriority.HIGH)
- public void SnowballEggDamage(CustomDamageEvent event)
+ @EventHandler(priority = EventPriority.NORMAL)
+ public void snowballEggDamage(CustomDamageEvent event)
{
-
- if(!_peace)
- {
- event.SetCancelled("Peace Phase");
- return;
- }
-
if (event.IsCancelled())
return;
@@ -375,13 +222,13 @@ public class SnowFight extends TeamGame
Projectile proj = event.GetProjectile();
if (proj == null)
return;
-
+
if(proj instanceof Fireball)
return;
-
+
if(proj instanceof Snowball)
event.AddMod("Snowball", "Snowball", 2, true);
-
+
event.SetIgnoreRate(true);
event.SetIgnoreArmor(true);
@@ -390,157 +237,64 @@ public class SnowFight extends TeamGame
((Player) proj.getShooter()).playSound(((Player) proj.getShooter()).getLocation(), Sound.SUCCESSFUL_HIT, 1, 1);
}
- private boolean IsSnow(Block block)
+ private boolean isSnow(Block block)
{
return block.getTypeId() == 78 || block.getTypeId() == 80;
}
-
- private boolean IsOnIce(Player player)
+
+ private boolean isOnIce(Player player)
{
- return player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.ICE;
- }
-
-
- private void makeMeteor()
- {
-
- Location loc = getEndgameLocation();
-
- if (loc == null)
- {
- return;
- }
-
- summonMeteor(loc, 20F);
-
- }
-
- private void summonMeteor(Location loc, float fireballSize)
- {
- Vector vector = new Vector(UtilMath.random.nextDouble() - 0.5D, 0.8, UtilMath.random.nextDouble() - 0.5D).normalize();
-
- vector.multiply(40);
-
- loc.add((UtilMath.random.nextDouble() - 0.5) * 7, 0, (UtilMath.random.nextDouble() - 0.5) * 7);
-
- loc.add(vector);
-
- final FallingBlock fallingblock = loc.getWorld().spawnFallingBlock(loc, Material.ICE, (byte) 0);
-
- fallingblock.setMetadata("Meteor", new FixedMetadataValue(getArcadeManager().getPlugin(), fireballSize));
-
- new BukkitRunnable()
- {
- int i;
-
- public void run()
- {
- if (fallingblock.isValid() && IsLive())
- {
- UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, fallingblock.getLocation(), 0.3F, 0.3F, 0.3F, 0, 3,
- ViewDist.MAX, UtilServer.getPlayers());
-
- if (i++ % 6 == 0)
- {
- fallingblock.getWorld().playSound(fallingblock.getLocation(), Sound.CAT_HISS, 0.7F, 0F);
- }
- }
- else
- {
- cancel();
- }
- }
- }.runTaskTimer(getArcadeManager().getPlugin(), 0, 0);
-
- vector.normalize().multiply(-(0.04 + ((0.5 - 0.05) / 2)));
- fallingblock.setFireTicks(9999);
- }
-
- @EventHandler
- public void MeteorHit(EntityChangeBlockEvent event)
- {
- Entity projectile = event.getEntity();
-
- float size = 2.5F;
- double damage = 2.5D;
+ //Side Standing
+ double xMod = player.getLocation().getX() % 1;
+ if (player.getLocation().getX() < 0)
+ xMod += 1;
- for(int i = 1; i <= 10; i++)
+ double zMod = player.getLocation().getZ() % 1;
+ if (player.getLocation().getZ() < 0)
+ zMod += 1;
+
+ int xMin = 0;
+ int xMax = 0;
+ int zMin = 0;
+ int zMax = 0;
+
+ if (xMod < 0.3) xMin = -1;
+ if (xMod > 0.7) xMax = 1;
+
+ if (zMod < 0.3) zMin = -1;
+ if (zMod > 0.7) zMax = 1;
+
+ for (int x=xMin ; x<=xMax ; x++)
{
- if(System.currentTimeMillis() >= getGameLiveTime() + (((30 * i) + 180) * 1000))
+ for (int z=zMin ; z<=zMax ; z++)
{
- size = 2.5F * i;
- damage = 2.5D * i;
- }
+ if (player.getLocation().add(x, -0.5, z).getBlock().getType() == Material.PACKED_ICE)
+ return true;
+ }
}
- if (projectile.hasMetadata("Meteor"))
- {
-
- CustomExplosion explosion = new CustomExplosion(getArcadeManager().GetDamage(), getArcadeManager().GetExplosion(),
- projectile.getLocation(), size, "Meteor");
-
- explosion.setBlockExplosionSize(size);
- explosion.setFallingBlockExplosion(false);
- explosion.setDropItems(false);
- explosion.setBlocksDamagedEqually(true);
-
- //Effect
- UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, projectile.getLocation(), 0.5f, 0.5f, 0.5f, 0, 5, ViewDist.MAX, UtilServer.getPlayers());
- for(Player player : UtilServer.getPlayers())
- player.playSound(projectile.getLocation(), Sound.EXPLODE, 1, 1);
-
-
- boolean fall = true;
-
- for(Entity player : projectile.getNearbyEntities(size, size, size))
- {
- if(player instanceof Player)
- {
- Player damagee = (Player) player;
- Bukkit.getPluginManager().callEvent(new CustomDamageEvent(damagee, null, null, null, DamageCause.CUSTOM, damage, false, true, true, "Ice Meteor", "Ice Meteor", false));
- }
- }
-
- for(Block block : UtilBlock.getInRadius(event.getEntity().getLocation(), size).keySet())
- {
- if(block.getType() != Material.AIR)
- {
- block.setType(Material.ICE);
-
- if(block.getRelative(BlockFace.DOWN).getType() == Material.AIR)
- {
- // to reduce lag
- if(fall)
- {
- block.getWorld().spawnFallingBlock(block.getLocation(), block.getType(), block.getData());
- fall = false;
- }
- else
- {
- fall = true;
- }
- block.setType(Material.AIR);
- }
- }
- }
-
- }
+ return false;
}
-
- private Location getEndgameLocation()
- {
- int chance = UtilMath.r(50) + 3;
- int accuracy = Math.max((int) (chance - (0.0001 * chance)), 1);
+ private Location getMeteorTargetLocation()
+ {
ArrayList players = GetPlayers(true);
+ //50 attempts, otherwise skip
for (int a = 0; a < 50; a++)
{
- Player player = players.get(UtilMath.r(players.size()));
+ Player player = UtilAlg.Random(players);
- Location location = player.getLocation().add(UtilMath.r(accuracy * 2) - accuracy, 0,
- UtilMath.r(accuracy * 2) - accuracy);
+ Location location = player.getLocation();
+
+ //random offset to player location
+ if (Math.random() > 0.1)
+ location.add(
+ (Math.random() - 0.5) * 32,
+ 0,
+ (Math.random() - 0.5) * 32);
+ //highest block!
location = WorldData.World.getHighestBlockAt(location).getLocation().add(0.5, 0, 0.5);
if (location.getBlock().getType() == Material.AIR)
@@ -550,6 +304,8 @@ public class SnowFight extends TeamGame
if (location.getBlockY() > 0 && location.getBlock().getType() != Material.AIR)
{
+ location.setY(player.getLocation().getY() + 80);
+
return location;
}
}
@@ -558,24 +314,170 @@ public class SnowFight extends TeamGame
}
@EventHandler
- public void Place(BlockPlaceEvent event)
+ public void meteorSpawn(UpdateEvent event)
{
- if(event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.ICE
- || event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.PACKED_ICE
- || event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.FENCE)
+ if(event.getType() != UpdateType.SEC)
+ return;
+
+ if (!IsLive())
+ return;
+
+ if(System.currentTimeMillis() <= getGameLiveTime() + _meteorTime)
+ return;
+
+ //Announce
+ if(!_meteors)
{
- UtilPlayer.message(event.getPlayer(), F.main("Game", "You cant place a Barrier here!"));
- event.setCancelled(true);
+ for(Player player : GetPlayers(false))
+ {
+ player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1F, 1F);
+ UtilTextMiddle.display(C.cAqua + C.Bold + "Ice Meteors", "Avoid the Ice Fields!", player);
+ }
+
+ _meteors = true;
+ }
+
+ //Spawn Meteor
+ Location loc = getMeteorTargetLocation();
+
+ if (loc == null)
+ return;
+
+ FallingBlock fallingblock = loc.getWorld().spawnFallingBlock(loc, Material.ICE, (byte) 0);
+
+ fallingblock.setMetadata("Meteor", new FixedMetadataValue(getArcadeManager().getPlugin(), 20f));
+
+ _meteorSet.add(fallingblock);
+ }
+
+ @EventHandler
+ public void meteorUpdate(UpdateEvent event)
+ {
+ if(event.getType() != UpdateType.TICK)
+ return;
+
+ if(!IsLive())
+ return;
+
+ Iterator blockIter = _meteorSet.iterator();
+
+ while (blockIter.hasNext())
+ {
+ FallingBlock block = blockIter.next();
+
+ if (block.isValid())
+ {
+ //Particle
+ UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, block.getLocation(), 0.3F, 0.3F, 0.3F, 0, 3,
+ ViewDist.MAX, UtilServer.getPlayers());
+
+ //Sound
+ if (block.getTicksLived() % 6 == 0)
+ block.getWorld().playSound(block.getLocation(), Sound.CAT_HISS, 0.5F, 0F);
+ }
+ //Clean
+ else
+ {
+ meteorExplode(block);
+
+ block.remove();
+ blockIter.remove();
+ }
+ }
+ }
+
+ @EventHandler
+ public void meteorHit(EntityChangeBlockEvent event)
+ {
+ event.setCancelled(true);
+
+ Entity projectile = event.getEntity();
+
+ if (projectile.hasMetadata("Meteor"))
+ {
+ meteorExplode(projectile);
+ _meteorSet.remove(projectile);
}
}
+ public void meteorExplode(Entity meteor)
+ {
+ float timePassed = (System.currentTimeMillis() - (getGameLiveTime() + _meteorTime))/1000f;
+
+ float multiplier = 1 + Math.min(3f, timePassed / 60f);
+
+ float size = 1.5f + multiplier;
+
+ //Effect
+ UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, meteor.getLocation(), 0.5f, 0.5f, 0.5f, 0, 5, ViewDist.MAX, UtilServer.getPlayers());
+ for(Player player : UtilServer.getPlayers())
+ player.playSound(meteor.getLocation(), Sound.EXPLODE, 1, 1);
+
+
+ //Damage
+ HashMap players = UtilPlayer.getInRadius(meteor.getLocation(), size + 3);
+ for (Player player : players.keySet())
+ {
+ //Damage Event
+ Manager.GetDamage().NewDamageEvent(player, null, null,
+ DamageCause.CUSTOM, size * players.get(player), false, true, false,
+ "Ice Meteor", "Ice Meteor", false);
+
+ //Vel
+ UtilAction.velocity(player, UtilAlg.getTrajectory(meteor, player), 1.2 * players.get(player), false, 0, 0.4, 1, true);
+ }
+
+ //Convert to Ice
+ for(Block block : UtilBlock.getInRadius(meteor.getLocation(), size).keySet())
+ {
+ int i = 20;
+ while (block.getY() > 0 && i>0)
+ {
+ if (block.getType() == Material.LADDER ||
+ block.getType() == Material.STAINED_GLASS ||
+ block.getType() == Material.STAINED_GLASS_PANE)
+ block.breakNaturally();
+
+
+ //Has air above it
+ if ((UtilBlock.solid(block) && UtilBlock.isVisible(block)) || block.isLiquid())
+ block.setType(Material.PACKED_ICE);
+
+ //shuffle down
+ block = block.getRelative(BlockFace.DOWN);
+ i--;
+ }
+ }
+
+ meteor.remove();
+ }
+
+
+ @EventHandler
+ public void iceDamage(UpdateEvent event)
+ {
+ if(event.getType() != UpdateType.FAST)
+ return;
+
+ if(!IsLive())
+ return;
+
+ for(Player player : GetPlayers(true))
+ {
+ if(isOnIce(player))
+ {
+ Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, null, DamageCause.CUSTOM, 1, false, true, true, "Ice", "Ice", false));
+ }
+ }
+ }
+
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
-
+
Scoreboard.Reset();
Scoreboard.WriteBlank();
@@ -585,7 +487,7 @@ public class SnowFight extends TeamGame
{
if (!team.IsTeamAlive())
continue;
-
+
for(Player player : team.GetPlayers(true))
{
Scoreboard.Write(team.GetColor() + player.getName());
@@ -604,20 +506,30 @@ public class SnowFight extends TeamGame
}
}
- long time = 1000 * 195 - (System.currentTimeMillis() - this.GetStateTime());
+ long time = _meteorTime - (System.currentTimeMillis() - this.GetStateTime());
- if (time > 0)
+ if(IsLive())
{
- Scoreboard.Write(C.cYellow + C.Bold + "Meteors");
- if(IsLive())
+ if (time > 0)
+ {
+ Scoreboard.Write(C.cYellow + C.Bold + "Meteors in");
Scoreboard.Write(UtilTime.MakeStr(time, 0));
+ }
+ else
+ {
+ Scoreboard.Write(C.cGold + C.Bold + "Meteors!");
+ }
}
- else
- {
- Scoreboard.Write(C.cGold + C.Bold + "Meteors!");
- }
+
Scoreboard.Draw();
}
+
+ @EventHandler
+ public void meteorStart(PlayerCommandPreprocessEvent event)
+ {
+ if (event.getPlayer().isOp() && event.getMessage().equals("/meteor"))
+ _meteorTime = 0;
+ }
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java
index efebaf42e..def43a186 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java
@@ -1,33 +1,27 @@
package nautilus.game.arcade.game.games.snowfight.kits;
-import mineplex.core.common.util.UtilInv;
-import mineplex.core.common.util.UtilMath;
+import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.kit.AbbreviatedKit;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
+import net.md_5.bungee.api.ChatColor;
-import org.bukkit.Color;
import org.bukkit.Material;
-import org.bukkit.entity.Egg;
-import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.PotionSplashEvent;
import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.LeatherArmorMeta;
+import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.potion.Potion;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
-public class KitMedic extends Kit
+public class KitMedic extends AbbreviatedKit
{
public KitMedic(ArcadeManager manager)
@@ -36,20 +30,15 @@ public class KitMedic extends Kit
new String[]
{
- "To the rescue...!",
- " ",
- "Gets 1 Snowball every second tile.",
- "Left-Click Snow to pick up Snowballs (Max. 16)",
- "Right-Click Snowballs to throw them.",
- " ",
- "Gets 1 Healing Potion every 32 seconds [max. 1]",
- "Slowness II when hit.",
- " ",
- "Supports all nearby allies with REGENERATION."
+ "Throw warmth potions to heal allies!",
+ ChatColor.RESET + " ",
+
+ C.cGray + "Receive 1 Warmth Potion every 16 seconds. Maximum of 1.",
},
new Perk[]
{
+
},
EntityType.SKELETON,
new ItemStack(Material.POTION));
@@ -60,8 +49,18 @@ public class KitMedic extends Kit
@Override
public void GiveItems(Player player)
{
- player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
- player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
+ Potion potion = new Potion(PotionType.INSTANT_HEAL);
+ potion.setSplash(true);
+ ItemStack stack = potion.toItemStack(1);
+ ItemMeta meta = stack.getItemMeta();
+ meta.setDisplayName(ChatColor.RESET + "Warmth Potion");
+ stack.setItemMeta(meta);
+
+ player.getInventory().setItem(1, stack);
+ player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew"));
+ player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew"));
+ player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew"));
+ player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew"));
}
@Override
@@ -72,31 +71,6 @@ public class KitMedic extends Kit
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
}
-
- @EventHandler
- public void Aura(UpdateEvent event)
- {
- if (event.getType() != UpdateType.FAST)
- return;
-
- for (Player player : Manager.GetGame().GetPlayers(true))
- {
- if (!HasKit(player))
- continue;
-
- for (Player other : Manager.GetGame().GetPlayers(true))
- {
- if (other.equals(player))
- continue;
-
- if (UtilMath.offset(player, other) > 4)
- continue;
-
- if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other)))
- Manager.GetCondition().Factory().Regen("Aura", other, player, 1.9, 0, false, false, false);
- }
- }
- }
@EventHandler
public void KitItems(UpdateEvent event)
@@ -104,7 +78,7 @@ public class KitMedic extends Kit
if(!Manager.GetGame().IsLive())
return;
- if (event.getType() == UpdateType.SLOWEST)
+ if (event.getType() == UpdateType.SLOWER)
{
for (Player player : Manager.GetGame().GetPlayers(true))
{
@@ -113,28 +87,13 @@ public class KitMedic extends Kit
Potion potion = new Potion(PotionType.INSTANT_HEAL);
potion.setSplash(true);
- player.getInventory().setItem(1, potion.toItemStack(1));
+ ItemStack stack = potion.toItemStack(1);
+ ItemMeta meta = stack.getItemMeta();
+ meta.setDisplayName("Warmth Potion");
+ stack.setItemMeta(meta);
+
+ player.getInventory().setItem(1, stack);
}
}
}
-
- @EventHandler
- public void Splash(PotionSplashEvent event)
- {
- if(event.getEntity().getShooter() instanceof Player)
- {
- if(!HasKit((Player) event.getEntity().getShooter()))
- return;
-
- for(Entity entity : event.getAffectedEntities())
- {
- if(entity instanceof Player)
- {
- Manager.GetCondition().Factory().Slow("Heal Potion", (Player)entity, (Player)event.getEntity().getShooter(), 5.0, 1, false, false, false, false);
- }
- }
-
- }
- }
-
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java
index 43bd655e3..f678d80dd 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java
@@ -1,5 +1,6 @@
package nautilus.game.arcade.game.games.snowfight.kits;
+import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
@@ -16,14 +17,17 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.kit.AbbreviatedKit;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
+import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkFallDamage;
+import nautilus.game.arcade.kit.perks.PerkSpeed;
-public class KitSportsman extends Kit
+public class KitSportsman extends AbbreviatedKit
{
-
+
public KitSportsman(ArcadeManager manager)
{
super(manager, "Sportsman", KitAvailability.Free,
@@ -31,17 +35,15 @@ public class KitSportsman extends Kit
new String[]
{
"Trained to be the fastest on snow and ice.",
- "",
- "Gets 1 Snowball every tile",
- "Left-Click Snow to pick up Snowballs (Max. 16)",
- "Right-Click Snowballs to throw them.",
- "",
- "Supports all nearby allies with SPEED."
+ ChatColor.RESET + " ",
+
},
new Perk[]
{
- new PerkFallDamage(3)
+ new PerkSpeed(0),
+ new PerkFallDamage(-2),
+ new PerkDoubleJump("Snow Jump", 1, 0.8, true, 6000, true),
},
EntityType.SKELETON,
new ItemStack(Material.SNOW_BALL));
@@ -51,8 +53,9 @@ public class KitSportsman extends Kit
@Override
public void GiveItems(Player player)
{
- player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
- player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
+ player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew"));
+ player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew"));
+ player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew"));
}
@Override
@@ -63,30 +66,4 @@ public class KitSportsman extends Kit
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
}
-
- @EventHandler
- public void Aura(UpdateEvent event)
- {
- if (event.getType() != UpdateType.FAST)
- return;
-
- for (Player player : Manager.GetGame().GetPlayers(true))
- {
- if (!HasKit(player))
- continue;
-
- for (Player other : Manager.GetGame().GetPlayers(true))
- {
- if (other.equals(player))
- continue;
-
- if (UtilMath.offset(player, other) > 4)
- continue;
-
- if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other)))
- Manager.GetCondition().Factory().Speed("Aura", other, player, 1.9, 0, false, false, false);
- }
- }
- }
-
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java
index a0aec26c1..3e035afb2 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java
@@ -1,29 +1,25 @@
package nautilus.game.arcade.game.games.snowfight.kits;
-import mineplex.core.common.util.UtilInv;
-import mineplex.core.common.util.UtilMath;
-import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
-import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.game.games.monsterleague.perks.PerkStoneWall;
+import nautilus.game.arcade.kit.AbbreviatedKit;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
-import nautilus.game.arcade.kit.perks.PerkFallDamage;
+import nautilus.game.arcade.kit.perks.PerkConstructor;
+import nautilus.game.arcade.kit.perks.PerkIronSkin;
-import org.bukkit.Color;
+import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.LeatherArmorMeta;
-import org.bukkit.potion.PotionType;
-public class KitTactician extends Kit
+public class KitTactician extends AbbreviatedKit
{
public KitTactician(ArcadeManager manager)
@@ -32,29 +28,24 @@ public class KitTactician extends Kit
new String[]
{
"No Snowfight is complete without a tactical game!",
- " ",
- "Gets 1 Snowball every second tile.",
- "Left-Click Snow to pick up Snowballs (Max. 16)",
- "Right-Click Snowballs to throw them.",
- " ",
- "Gets 1 Barrier every 32 seconds [max. 2]",
- "Place Barriers to improve your defense.",
- "You cant place Barriers above Ice, Packed Ice or Fences.",
- " ",
- "Supports all nearby allies with RESISTANCE."
+ ChatColor.RESET + " ",
+
}, new Perk[]
{
+ new PerkStoneWall("Ice Wall", Material.ICE, Material.CLAY_BALL),
},
EntityType.SKELETON,
- new ItemStack(Material.FENCE));
+ new ItemStack(Material.CLAY_BALL));
}
@Override
public void GiveItems(Player player)
{
- player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
- player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
+ player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.CLAY_BALL, (byte)0, 1, ChatColor.RESET + "Ice Wall"));
+ player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew"));
+ player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew"));
+ player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew"));
player.getInventory().setItem(7, ItemStackFactory.Instance.CreateStack(Material.COMPASS.getId(), (byte) 0, 1, "§a§lTracking Compass"));
}
@@ -66,53 +57,4 @@ public class KitTactician extends Kit
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
}
-
- @EventHandler
- public void Aura(UpdateEvent event)
- {
- if (event.getType() != UpdateType.FAST)
- return;
-
- for (Player player : Manager.GetGame().GetPlayers(true))
- {
- if (!HasKit(player))
- continue;
-
- for (Player other : Manager.GetGame().GetPlayers(true))
- {
- if (other.equals(player))
- continue;
-
- if (UtilMath.offset(player, other) > 4)
- continue;
-
- if( Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other)))
- Manager.GetCondition().Factory().Protection("Aura", other, player, 1.9, 0, false, false, false);
- }
- }
- }
-
- @EventHandler
- public void KitItems(UpdateEvent event)
- {
- if(!Manager.GetGame().IsLive())
- return;
-
- if (event.getType() == UpdateType.SLOWEST)
- {
- for (Player player : Manager.GetGame().GetPlayers(true))
- {
- if (!HasKit(player))
- continue;
-
- int amount = 0;
- if (player.getInventory().getItem(1) != null && UtilInv.contains(player, Material.FENCE, (byte) 0, 1))
- amount = 2;
- else
- amount = 1;
- player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.FENCE, (byte) 0, amount, "Barrier"));
- }
- }
- }
-
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java
index 4890bc63e..dfbc490a4 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java
@@ -17,11 +17,12 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
+import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
-import nautilus.game.arcade.kit.Perk;
+import nautilus.game.arcade.kit.SmashPerk;
-public class PerkBlink extends Perk
+public class PerkBlink extends SmashPerk
{
private String _name = "";
private double _range;
@@ -45,17 +46,22 @@ public class PerkBlink extends Perk
if (event.isCancelled())
return;
- if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK &&
- event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
+ if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
+
+ if (!UtilGear.isAxe(event.getPlayer().getItemInHand()))
+ return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
+
+ if (isSuperActive(player))
+ return;
if (!Recharge.Instance.use(player, _name, _recharge, true, true))
return;
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java
index 7f65cc868..0c7481f59 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java
@@ -35,6 +35,7 @@ import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.uhc.UHC;
+import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Location;
@@ -52,6 +53,7 @@ public class GameManager implements Listener
ArcadeManager Manager;
private int _colorId = 0;
+ private int _animationIndex = 0;
public GameManager(ArcadeManager manager)
{
@@ -60,10 +62,27 @@ public class GameManager implements Listener
Manager.getPluginManager().registerEvents(this, Manager.getPlugin());
}
+ @EventHandler
+ public void displaySale(UpdateEvent event)
+ {
+ if (event.getType() != UpdateType.MIN_08)
+ return;
+
+ for (Player player : UtilServer.getPlayers())
+ if ((Manager.getName() == null || !Manager.GetGame().IsAlive(player)) && !Manager.getPreferences().Get(player).DisableAds)
+ {
+ player.sendMessage(C.cWhite + " ");
+ player.sendMessage(C.cRedB + " MASSIVE WINTER SALE");
+ player.sendMessage(C.cWhiteB + " 50% OFF ALL RANKS");
+ player.sendMessage(" " + C.cGreen + C.Line + "www.mineplex.com/shop");
+ player.sendMessage(C.cWhite + " ");
+ }
+ }
+
@EventHandler
public void DisplayIP(UpdateEvent event)
{
- if (event.getType() != UpdateType.FASTER)
+ if (event.getType() != UpdateType.FASTEST)
return;
if (Manager.GetGame() != null && !Manager.GetGame().InProgress())
@@ -76,6 +95,51 @@ public class GameManager implements Listener
String text = col + C.Bold + "US.MINEPLEX.COM EU.MINEPLEX.COM";
+
+
+
+ //Christmas
+ _animationIndex = (_animationIndex + 1) % 40;
+
+ if (_animationIndex == 0) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 5" + C.cWhiteB + "0% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 1) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50" + C.cWhiteB + "% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 2) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% " + C.cWhiteB + "OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 3) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% O" + C.cWhiteB + "FF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 4) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OF" + C.cWhiteB + "F ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 5) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF " + C.cWhiteB + "ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 6) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF A" + C.cWhiteB + "LL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 7) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF AL" + C.cWhiteB + "L RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 8) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL " + C.cWhiteB + "RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 9) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL R" + C.cWhiteB + "ANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 10) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RA" + C.cWhiteB + "NKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 11) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RAN" + C.cWhiteB + "KS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 12) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANK" + C.cWhiteB + "S " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 13) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+
+ if (_animationIndex == 14) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 15) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 16) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 17) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 18) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 19) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 20) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 21) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 22) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 23) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 24) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 25) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cWhiteB + " 50% OFF ALL RANKS" + C.cGreenB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+ if (_animationIndex == 26) text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " 50% OFF ALL RANKS" + C.cWhiteB + " " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+
+ if (_animationIndex >= 27)
+ text = C.cWhite + " ❄ " + C.cRed + " Massive Winter Sale " + C.cGreenB + " " + C.cWhiteB + "50% OFF ALL RANKS " + C.cYellow + " www.mineplex.com/shop " + C.cWhite + " ❄";
+
+
+
+
+
+
+
+
double health = 1;
if (Manager.GetGame().GetState() == GameState.Recruit)
{
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java
index 570ea9ea3..ba2c0d8cd 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java
@@ -52,7 +52,7 @@ public class HolidayManager implements Listener
{
public enum HolidayType
{
- Christmas(Material.CHEST, "Present", Sound.LEVEL_UP),
+ Christmas(Material.CHEST, "Present", Sound.CAT_MEOW),
Halloween(Material.PUMPKIN, "Pumpkin", Sound.ZOMBIE_REMEDY),
Easter(Material.CHEST, "Egg Basket", Sound.CAT_MEOW);
@@ -83,8 +83,8 @@ public class HolidayManager implements Listener
}
}
- private HolidayType type = HolidayType.Halloween;
- private String _statName = "Halloween Pumpkins 2015";
+ private HolidayType type = HolidayType.Christmas;
+ private String _statName = "Christmas Presents 2015";
ArcadeManager Manager;
private TitanGiveawayManager _titanManager;
@@ -117,7 +117,7 @@ public class HolidayManager implements Listener
@EventHandler
public void blockEffect(UpdateEvent event)
{
- if (event.getType() == UpdateType.TICK)
+ if (event.getType() != UpdateType.TICK)
return;
Iterator blockIterator = _active.iterator();
@@ -173,6 +173,11 @@ public class HolidayManager implements Listener
sendChestPackets(block);
}
}
+ else if (type == HolidayType.Christmas)
+ {
+ UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, block.getLocation().add(0.5, 1, 0.5), 0.5f, 0.5f, 0.5f, 0, 3,
+ ViewDist.LONG, UtilServer.getPlayers());
+ }
}
}
@@ -288,18 +293,21 @@ public class HolidayManager implements Listener
}
@EventHandler
- public void specialBlockDamage(BlockDamageEvent event)
+ public void specialBlockDamage(PlayerInteractEvent event)
{
+ if (!UtilEvent.isAction(event, ActionType.L_BLOCK))
+ return;
+
if (UtilPlayer.isSpectator(event.getPlayer()))
return;
if (Manager.GetGame() != null && !Manager.GetGame().IsAlive(event.getPlayer()))
return;
- if (!_active.contains(event.getBlock()))
+ if (!_active.contains(event.getClickedBlock()))
return;
- specialBlockBreak(event.getPlayer(), event.getBlock());
+ specialBlockBreak(event.getPlayer(), event.getClickedBlock());
}
private void specialBlockBreak(Player player, final Block block)
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java
index 068035b74..74242f538 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java
@@ -54,10 +54,10 @@ public class WorldData
public GameType Game = null;
- public HashMap> SpawnLocs = new HashMap>();
- private HashMap> DataLocs = new HashMap>();
- private HashMap> CustomLocs = new HashMap>();
- private final Map _dataEntries = new HashMap<>();
+ public HashMap> SpawnLocs = new LinkedHashMap>();
+ private HashMap> DataLocs = new LinkedHashMap>();
+ private HashMap> CustomLocs = new LinkedHashMap>();
+ private final Map _dataEntries = new LinkedHashMap<>();
public WorldData(Game game)
{