merge with master
This commit is contained in:
commit
ac6d3c2c8f
@ -66,10 +66,10 @@
|
||||
</fileset>
|
||||
<fileset dir="../Mineplex.Core/bin">
|
||||
<include name="**/*.class"/>
|
||||
<include name="**/*.png"/>
|
||||
</fileset>
|
||||
<fileset dir="../Mineplex.Core.Common/bin">
|
||||
<include name="**/*.class"/>
|
||||
<include name="**/*.png"/>
|
||||
</fileset>
|
||||
<fileset dir="../Mineplex.Minecraft.Game.ClassCombat/bin">
|
||||
<include name="**/*.class"/>
|
||||
|
@ -8,6 +8,6 @@
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.ServerData"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpclient-4.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpcore-4.2.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.PlayerCache"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Cache"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -5,8 +5,8 @@ import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import mineplex.bungee.playerStats.data.IpInfo;
|
||||
import mineplex.playerCache.PlayerCache;
|
||||
import mineplex.playerCache.PlayerInfo;
|
||||
import mineplex.cache.player.PlayerCache;
|
||||
import mineplex.cache.player.PlayerInfo;
|
||||
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
|
@ -9,7 +9,7 @@ import java.sql.Statement;
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.bungee.playerStats.data.IpInfo;
|
||||
import mineplex.playerCache.PlayerInfo;
|
||||
import mineplex.cache.player.PlayerInfo;
|
||||
|
||||
public class PlayerStatsRepository
|
||||
{
|
||||
|
BIN
Plugins/Mineplex.Core.Common/src/mineplex/core/common/ascii.png
Normal file
BIN
Plugins/Mineplex.Core.Common/src/mineplex/core/common/ascii.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
@ -0,0 +1,18 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
public enum LineFormat
|
||||
{
|
||||
LORE(200), CHAT(319);
|
||||
|
||||
private int _length;
|
||||
|
||||
private LineFormat(int length)
|
||||
{
|
||||
_length = length;
|
||||
}
|
||||
|
||||
public int getLength()
|
||||
{
|
||||
return _length;
|
||||
}
|
||||
}
|
@ -835,7 +835,7 @@ public class UtilBlock
|
||||
return getBedHead(bed.getBlock()) != null && getBedFoot(bed.getBlock()) != null;
|
||||
}
|
||||
|
||||
public static HashSet<Block> findConnectedBlocks(Block block, HashSet<Block> blocks, int limit)
|
||||
public static HashSet<Block> findConnectedBlocks(Block source, Block block, HashSet<Block> blocks, int limit, double range)
|
||||
{
|
||||
if (blocks == null)
|
||||
blocks = new HashSet<Block>();
|
||||
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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<Player> getSortedPlayers()
|
||||
{
|
||||
return getSortedPlayers(new Comparator<Player>()
|
||||
|
@ -1,52 +1,452 @@
|
||||
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 <T> String listToString(Collection<T> inputList, boolean comma) {
|
||||
String out = "";
|
||||
public class UtilText
|
||||
{
|
||||
private static HashMap<Character, Integer> _characters = new HashMap<Character, Integer>();
|
||||
|
||||
for (T cur : inputList) {
|
||||
out += cur.toString() + (comma ? ", " : " ");
|
||||
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();
|
||||
}
|
||||
|
||||
if (out.length() > 0) {
|
||||
out = out.substring(0, out.length() - (comma ? 2 : 1));
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
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++;
|
||||
|
||||
|
||||
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 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 alignRight(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 = 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 == '<27>')
|
||||
{
|
||||
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<String> splitLines(String[] strings, LineFormat lineFormat)
|
||||
{
|
||||
ArrayList<String> lines = new ArrayList<String>();
|
||||
|
||||
for (String s : strings)
|
||||
{
|
||||
lines.addAll(splitLine(s, lineFormat));
|
||||
}
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
public static ArrayList<String> splitLine(String string, LineFormat lineFormat)
|
||||
{
|
||||
ArrayList<String> strings = new ArrayList<String>();
|
||||
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 == '<27>')
|
||||
{
|
||||
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,84 +455,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 <T> String listToString(Collection<T> 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 <X> 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 <X> String arrayToString(X[] array)
|
||||
{
|
||||
return arrayToString(array, null);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jooq-3.5.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/NoCheatPlus.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.PlayerCache"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Cache"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -9,6 +9,9 @@ import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import mineplex.cache.player.PlayerCache;
|
||||
import mineplex.cache.player.PlayerInfo;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.command.TestRank;
|
||||
import mineplex.core.account.command.UpdateRank;
|
||||
@ -24,8 +27,6 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.timing.TimingManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.playerCache.PlayerCache;
|
||||
import mineplex.playerCache.PlayerInfo;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
@ -7,29 +7,21 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.sql.Types;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sun.org.apache.xpath.internal.operations.Bool;
|
||||
import mineplex.core.bonuses.gui.SpinGui;
|
||||
import mineplex.core.common.Pair;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.database.DBPool;
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.core.database.ResultSetCallable;
|
||||
import mineplex.core.database.column.ColumnInt;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.database.Tables;
|
||||
import mineplex.database.tables.records.BonusRecord;
|
||||
import org.jooq.Configuration;
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.Record2;
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.TableField;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.jooq.impl.DefaultConfiguration;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import mineplex.cache.player.PlayerCache;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -16,7 +17,6 @@ import mineplex.core.pet.repository.token.PetChangeToken;
|
||||
import mineplex.core.pet.repository.token.PetToken;
|
||||
import mineplex.core.shop.page.ConfirmationPage;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.playerCache.PlayerCache;
|
||||
import net.minecraft.server.v1_8_R3.ItemStack;
|
||||
import net.minecraft.server.v1_8_R3.Items;
|
||||
|
||||
|
@ -10,6 +10,8 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import mineplex.cache.player.PlayerCache;
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.ClientWebResponseEvent;
|
||||
@ -24,7 +26,6 @@ import mineplex.core.donation.repository.token.DonorTokenWrapper;
|
||||
import mineplex.core.server.util.TransactionResponse;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.playerCache.PlayerCache;
|
||||
|
||||
public class DonationManager extends MiniDbClientPlugin<Donor>
|
||||
{
|
||||
|
@ -22,6 +22,7 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.cache.player.PlayerCache;
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.Callback;
|
||||
@ -31,7 +32,6 @@ import mineplex.core.inventory.data.InventoryRepository;
|
||||
import mineplex.core.inventory.data.Item;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.playerCache.PlayerCache;
|
||||
|
||||
public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ public class MountCart extends Mount<SingleEntityMountData<Minecart>>
|
||||
if (event.getRightClicked() == null)
|
||||
return;
|
||||
|
||||
SingleEntityMountData<Minecart> mount = GetActive().get(event.getPlayer());
|
||||
SingleEntityMountData<Minecart> mount = getMountData(event.getRightClicked());
|
||||
|
||||
if(mount == null) return;
|
||||
|
||||
|
@ -30,11 +30,11 @@ public class MountSlime extends Mount<SingleEntityMountData<Slime>>
|
||||
{
|
||||
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<SingleEntityMountData<Slime>>
|
||||
{
|
||||
player.leaveVehicle();
|
||||
player.eject();
|
||||
|
||||
|
||||
//Remove other mounts
|
||||
Manager.DeregisterAll(player);
|
||||
|
||||
|
||||
SingleEntityMountData<Slime> mount = new SingleEntityMountData<Slime>(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<Slime> 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<Slime> 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<Slime> 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<Slime> 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<Slime> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -16,10 +16,10 @@ public class NBSReader
|
||||
{
|
||||
public static NoteSong loadSong(String fileName) throws FileNotFoundException
|
||||
{
|
||||
return loadSong(new DataInputStream(new FileInputStream(new File(fileName))));
|
||||
return loadSong(new DataInputStream(new FileInputStream(new File(fileName))), fileName);
|
||||
}
|
||||
|
||||
public static NoteSong loadSong(DataInputStream stream)
|
||||
public static NoteSong loadSong(DataInputStream stream, String defaultName)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -41,6 +41,9 @@ public class NBSReader
|
||||
int blocksRemoved = readInt(stream);
|
||||
String midiFileName = readString(stream);
|
||||
|
||||
if ((name == null || name.length() == 0) && defaultName != null)
|
||||
name = defaultName;
|
||||
|
||||
HashMap<Integer, NoteLayer> layerMap = new HashMap<Integer, NoteLayer>();
|
||||
|
||||
// Note Block Information
|
||||
|
@ -13,6 +13,7 @@ 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;
|
||||
|
||||
@ -21,6 +22,7 @@ public class NotificationManager extends MiniPlugin
|
||||
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 + "█" +
|
||||
@ -30,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
|
||||
@ -55,11 +58,17 @@ public class NotificationManager extends MiniPlugin
|
||||
|
||||
private void christmasSale()
|
||||
{
|
||||
Bukkit.broadcastMessage(C.cWhite + " ");
|
||||
Bukkit.broadcastMessage(C.cRedB + " MASSIVE WINTER SALE");
|
||||
Bukkit.broadcastMessage(C.cWhiteB + " 50% OFF ALL RANKS");
|
||||
Bukkit.broadcastMessage(" " + C.cGreen + C.Line + "www.mineplex.com/shop");
|
||||
Bukkit.broadcastMessage(C.cWhite + " ");
|
||||
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()
|
||||
|
@ -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<BungeeServer> _repository;
|
||||
private DataRepository<BungeeServer> _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<BungeeServer>(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<BungeeServer>(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<BungeeServer>(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);
|
||||
}
|
||||
|
||||
}
|
@ -136,6 +136,6 @@ public class PreferencesManager extends MiniDbClientPlugin<UserPreferences>
|
||||
@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, hubMusic 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;";
|
||||
}
|
||||
}
|
||||
|
@ -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 = ?, hubMusic = ? 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)
|
||||
{
|
||||
@ -62,8 +62,9 @@ public class PreferencesRepository extends RepositoryBase
|
||||
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(15, entry.getKey());
|
||||
preparedStatement.setString(16, entry.getKey());
|
||||
|
||||
preparedStatement.addBatch();
|
||||
}
|
||||
@ -91,8 +92,9 @@ public class PreferencesRepository extends RepositoryBase
|
||||
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(15, entry.getKey());
|
||||
preparedStatement.setString(16, entry.getKey());
|
||||
preparedStatement.execute();
|
||||
}
|
||||
|
||||
@ -125,7 +127,7 @@ public class PreferencesRepository extends RepositoryBase
|
||||
preferences.friendDisplayInventoryUI = resultSet.getBoolean(12);
|
||||
preferences.ClanTips = resultSet.getBoolean(13);
|
||||
preferences.HubMusic = resultSet.getBoolean(14);
|
||||
System.out.println("<< " + resultSet.getBoolean(13));
|
||||
preferences.DisableAds = resultSet.getBoolean(15);
|
||||
}
|
||||
|
||||
return preferences;
|
||||
|
@ -17,4 +17,5 @@ public class UserPreferences
|
||||
public boolean friendDisplayInventoryUI = true;
|
||||
public boolean ClanTips = true;
|
||||
public volatile boolean HubMusic = true;
|
||||
public boolean DisableAds = false;
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
|
||||
private IButton _togglePendingFriendRequests;
|
||||
private IButton _toggleClanTips;
|
||||
private IButton _toggleHubMusic;
|
||||
private IButton _toggleDisableAds;
|
||||
|
||||
private boolean _hubGamesToggled;
|
||||
private boolean _hubPlayersToggled;
|
||||
@ -35,6 +36,7 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
|
||||
private boolean _pendingFriendRequestsToggled;
|
||||
private boolean _clanTipsToggled;
|
||||
private boolean _hubMusicToggled;
|
||||
private boolean _disableAdsToggled;
|
||||
|
||||
private ExclusivePreferencesShop _exclusiveShop;
|
||||
|
||||
@ -120,6 +122,15 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
|
||||
toggleHubMusic(player);
|
||||
}
|
||||
};
|
||||
|
||||
_toggleDisableAds = new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
toggleDisableAds(player);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void toggleHubMusic(Player player)
|
||||
@ -129,6 +140,14 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
|
||||
buildPage();
|
||||
}
|
||||
|
||||
private void toggleDisableAds(Player player)
|
||||
{
|
||||
getPlugin().Get(player).DisableAds = !getPlugin().Get(player).DisableAds;
|
||||
_disableAdsToggled = !_disableAdsToggled;
|
||||
buildPage();
|
||||
}
|
||||
|
||||
|
||||
private void toggleHubPartyRequests(Player player)
|
||||
{
|
||||
getPlugin().Get(player).PartyRequests = !getPlugin().Get(player).PartyRequests;
|
||||
@ -197,8 +216,9 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
|
||||
|
||||
UserPreferences userPreferences = getPlugin().Get(getPlayer());
|
||||
Rank rank = getClientManager().Get(getPlayer()).GetRank();
|
||||
|
||||
int[] indices = UtilUI.getIndicesFor(8, 0, 2);
|
||||
|
||||
int amount = rank.has(Rank.ULTRA) ? 9 : 8;
|
||||
int[] indices = UtilUI.getIndicesFor(amount, 0, 2);
|
||||
|
||||
buildPreference(indices[0], Material.FIREBALL, "Hub Player Stacker", userPreferences.HubGames, _toggleHubGames);
|
||||
buildPreference(indices[1], Material.EYE_OF_ENDER, "Hub Player Visibility", userPreferences.ShowPlayers, _toggleHubPlayers);
|
||||
@ -208,6 +228,8 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
|
||||
buildPreference(indices[5], Material.RED_ROSE, "Show Pending Friend Requests", userPreferences.PendingFriendRequests, _togglePendingFriendRequests);
|
||||
buildPreference(indices[6], Material.IRON_SWORD, "Show Clan Tips", userPreferences.ClanTips, _toggleClanTips);
|
||||
buildPreference(indices[7], Material.NOTE_BLOCK, "Hub Music", userPreferences.HubMusic, _toggleHubMusic);
|
||||
if (rank.has(Rank.ULTRA))
|
||||
buildPreference(indices[8], Material.BARRIER, "Disable Ads", userPreferences.DisableAds, _toggleDisableAds);
|
||||
|
||||
if (rank.has(Rank.MODERATOR) || rank == Rank.YOUTUBE || rank == Rank.TWITCH)
|
||||
{
|
||||
@ -238,6 +260,6 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
|
||||
|
||||
public boolean preferencesChanged()
|
||||
{
|
||||
return _hubGamesToggled || _hubPlayersToggled || _hubChatToggled || _hubPrivateChatToggled || _hubPartyRequestsToggled || _pendingFriendRequestsToggled || _clanTipsToggled || _hubMusicToggled;
|
||||
return _hubGamesToggled || _hubPlayersToggled || _hubChatToggled || _hubPrivateChatToggled || _hubPartyRequestsToggled || _pendingFriendRequestsToggled || _clanTipsToggled || _hubMusicToggled || _disableAdsToggled;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package mineplex.core.profileCache;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.ProfileLookupCallback;
|
||||
|
||||
public class ProfileCacheLookupCallback implements ProfileLookupCallback
|
||||
{
|
||||
private ProfileCacheManager _profileCacheManager;
|
||||
private ProfileLookupCallback _profileLookupCallback;
|
||||
|
||||
public ProfileCacheLookupCallback(ProfileCacheManager profileCacheManager, ProfileLookupCallback profileLookupCallback)
|
||||
{
|
||||
_profileCacheManager = profileCacheManager;
|
||||
_profileLookupCallback = profileLookupCallback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProfileLookupFailed(GameProfile gameProfile, Exception exception)
|
||||
{
|
||||
_profileLookupCallback.onProfileLookupFailed(gameProfile, exception);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProfileLookupSucceeded(GameProfile gameProfile)
|
||||
{
|
||||
_profileCacheManager.cacheProfile(gameProfile);
|
||||
_profileLookupCallback.onProfileLookupSucceeded(gameProfile);
|
||||
}
|
||||
}
|
@ -1,81 +1,134 @@
|
||||
//package mineplex.core.profileCache;
|
||||
//
|
||||
//import java.util.UUID;
|
||||
//
|
||||
//import org.bukkit.plugin.java.JavaPlugin;
|
||||
//import net.minecraft.util.com.google.gson.Gson;
|
||||
//import net.minecraft.util.com.google.gson.GsonBuilder;
|
||||
//import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
//import net.minecraft.util.com.mojang.authlib.properties.PropertyMap;
|
||||
//import net.minecraft.util.com.mojang.authlib.yggdrasil.ProfileCache;
|
||||
//import net.minecraft.util.com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository;
|
||||
//import net.minecraft.util.com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService;
|
||||
//import net.minecraft.util.com.mojang.authlib.yggdrasil.response.ProfileSearchResultsResponse;
|
||||
//import net.minecraft.util.com.mojang.util.UUIDTypeAdapter;
|
||||
//
|
||||
//import mineplex.core.MiniPlugin;
|
||||
//import mineplex.serverdata.Region;
|
||||
//import mineplex.serverdata.redis.RedisDataRepository;
|
||||
//import mineplex.serverdata.servers.ServerManager;
|
||||
//
|
||||
//public class ProfileCacheManager extends MiniPlugin implements ProfileCache
|
||||
//{
|
||||
// private RedisDataRepository<ProfileData> _profileRepository;
|
||||
// private Gson _gson;
|
||||
//
|
||||
// public ProfileCacheManager(JavaPlugin plugin)
|
||||
// {
|
||||
// super("Profile Cache", plugin);
|
||||
//
|
||||
// _profileRepository = new RedisDataRepository<ProfileData>(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(),
|
||||
// Region.ALL, ProfileData.class, "profileCacheRepo");
|
||||
//
|
||||
// GsonBuilder builder = new GsonBuilder();
|
||||
// builder.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer());
|
||||
// builder.registerTypeAdapter(UUID.class, new UUIDTypeAdapter());
|
||||
// builder.registerTypeAdapter(ProfileSearchResultsResponse.class, new net.minecraft.util.com.mojang.authlib.yggdrasil.response.ProfileSearchResultsResponse.Serializer());
|
||||
// _gson = builder.create();
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// YggdrasilMinecraftSessionService.setProfileCache(this);
|
||||
// YggdrasilGameProfileRepository.setProfileCache(this);
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// System.out.println("================================================");
|
||||
// System.out.println("Failed to load Profile Cache (Skins)");
|
||||
// System.out.println("Are you using the correct modified Craftbukkit?");
|
||||
// System.out.println("================================================");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public GameProfile attemptToLoadProfile(String playerName)
|
||||
// {
|
||||
// ProfileData profile = _profileRepository.getElement(playerName.toLowerCase());
|
||||
//
|
||||
// if (profile != null)
|
||||
// {
|
||||
// PropertyMap propertyMap = _gson.fromJson(profile.getPropertyMap(), PropertyMap.class);
|
||||
// GameProfile gameProfile = new GameProfile(profile.getUuid(), profile.getPlayerName());
|
||||
// gameProfile.getProperties().putAll(propertyMap);
|
||||
//
|
||||
//// System.out.println("Loaded profile " + playerName + " from repository!");
|
||||
// return gameProfile;
|
||||
// }
|
||||
//
|
||||
//// System.out.println("Profile Null");
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void cacheProfile(GameProfile profile)
|
||||
// {
|
||||
//// System.out.println("Cached profile: " + profile.getName());
|
||||
// ProfileData data = new ProfileData(profile.getId(), profile.getName(), _gson.toJson(profile.getProperties()));
|
||||
// _profileRepository.addElement(data, 60 * 60 * 24); // 1 day
|
||||
// }
|
||||
//}
|
||||
package mineplex.core.profileCache;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.mojang.authlib.Agent;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.GameProfileRepository;
|
||||
import com.mojang.authlib.ProfileLookupCallback;
|
||||
import com.mojang.authlib.properties.PropertyMap;
|
||||
import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository;
|
||||
import com.mojang.authlib.yggdrasil.response.ProfileSearchResultsResponse;
|
||||
import com.mojang.util.UUIDTypeAdapter;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.serverdata.Region;
|
||||
import mineplex.serverdata.redis.RedisDataRepository;
|
||||
import mineplex.serverdata.servers.ServerManager;
|
||||
|
||||
public class ProfileCacheManager extends MiniPlugin implements GameProfileRepository
|
||||
{
|
||||
private YggdrasilGameProfileRepository _mojangProfileRepository;
|
||||
private RedisDataRepository<ProfileData> _profileRepository;
|
||||
private Gson _gson;
|
||||
|
||||
public ProfileCacheManager(JavaPlugin plugin)
|
||||
{
|
||||
super("Profile Cache", plugin);
|
||||
|
||||
_profileRepository = new RedisDataRepository<ProfileData>(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(),
|
||||
Region.ALL, ProfileData.class, "profileCacheRepo");
|
||||
|
||||
GsonBuilder builder = new GsonBuilder();
|
||||
builder.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer());
|
||||
builder.registerTypeAdapter(UUID.class, new UUIDTypeAdapter());
|
||||
builder.registerTypeAdapter(ProfileSearchResultsResponse.class, new com.mojang.authlib.yggdrasil.response.ProfileSearchResultsResponse.Serializer());
|
||||
_gson = builder.create();
|
||||
|
||||
try
|
||||
{
|
||||
Field mojangProfileRepo = net.minecraft.server.v1_8_R3.MinecraftServer.class.getDeclaredField("Y");
|
||||
|
||||
mojangProfileRepo.setAccessible(true);
|
||||
|
||||
_mojangProfileRepository = (YggdrasilGameProfileRepository) mojangProfileRepo.get(((CraftServer)Bukkit.getServer()).getServer());
|
||||
mojangProfileRepo.set(((CraftServer)Bukkit.getServer()).getServer(), this);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
System.out.println("================================================");
|
||||
System.out.println("Failed to load Profile Cache (Skins)");
|
||||
System.out.println("Are you using the correct modified Craftbukkit?");
|
||||
System.out.println("================================================");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public GameProfile attemptToLoadProfile(String playerName)
|
||||
{
|
||||
ProfileData profile = _profileRepository.getElement(playerName.toLowerCase());
|
||||
|
||||
if (profile != null)
|
||||
{
|
||||
PropertyMap propertyMap = _gson.fromJson(profile.getPropertyMap(), PropertyMap.class);
|
||||
GameProfile gameProfile = new GameProfile(profile.getUuid(), profile.getPlayerName());
|
||||
gameProfile.getProperties().putAll(propertyMap);
|
||||
return gameProfile;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void cacheProfile(final GameProfile profile)
|
||||
{
|
||||
if (Bukkit.isPrimaryThread())
|
||||
{
|
||||
runAsync(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
cacheProfileSafely(profile);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
cacheProfileSafely(profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findProfilesByNames(String[] profileNames, Agent agent, ProfileLookupCallback profileLookupCallback)
|
||||
{
|
||||
List<String> uncachedProfileNames = new ArrayList<>();
|
||||
|
||||
for (String profileName : profileNames)
|
||||
{
|
||||
GameProfile profile = attemptToLoadProfile(profileName);
|
||||
|
||||
if (profile == null)
|
||||
uncachedProfileNames.add(profileName);
|
||||
else
|
||||
profileLookupCallback.onProfileLookupSucceeded(profile);
|
||||
}
|
||||
|
||||
_mojangProfileRepository.findProfilesByNames(uncachedProfileNames.toArray(new String[uncachedProfileNames.size()]), agent, new ProfileCacheLookupCallback(this, profileLookupCallback));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void clearRepository(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.MIN_10)
|
||||
return;
|
||||
|
||||
_profileRepository.clean();
|
||||
}
|
||||
|
||||
private void cacheProfileSafely(GameProfile profile)
|
||||
{
|
||||
ProfileData data = new ProfileData(profile.getId(), profile.getName(), _gson.toJson(profile.getProperties()));
|
||||
_profileRepository.addElement(data, 60 * 60 * 24); // 1 day
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.cache.player.PlayerCache;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.pet.PetManager;
|
||||
@ -13,7 +14,6 @@ import mineplex.core.pet.repository.token.PetToken;
|
||||
import mineplex.core.reward.RewardData;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.reward.RewardType;
|
||||
import mineplex.playerCache.PlayerCache;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-18.
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.cache.player.PlayerCache;
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
@ -16,7 +17,6 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.stats.command.GiveStatCommand;
|
||||
import mineplex.core.stats.command.TimeCommand;
|
||||
import mineplex.core.stats.event.StatChangeEvent;
|
||||
import mineplex.playerCache.PlayerCache;
|
||||
|
||||
public class StatsManager extends MiniDbClientPlugin<PlayerStats>
|
||||
{
|
||||
|
@ -5,12 +5,12 @@ import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.cache.player.PlayerCache;
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.task.repository.TaskRepository;
|
||||
import mineplex.playerCache.PlayerCache;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Database"/>
|
||||
|
@ -38,6 +38,7 @@ import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.poll.PollManager;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.profileCache.ProfileCacheManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
@ -182,6 +183,8 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"), true);
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"), true);
|
||||
|
||||
new ProfileCacheManager(this);
|
||||
|
||||
//Updates
|
||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
||||
}
|
||||
|
@ -27,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;
|
||||
@ -233,7 +234,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
_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;
|
||||
@ -260,7 +261,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
if (file.getName().endsWith(".nbs"))
|
||||
{
|
||||
System.out.println("Loading Song " + file.getPath());
|
||||
NoteSong song = NBSReader.loadSong(new DataInputStream(new FileInputStream(file)));
|
||||
NoteSong song = NBSReader.loadSong(new DataInputStream(new FileInputStream(file)), file.getName().replace("_", " ").replace(".nbs", ""));
|
||||
if (song != null)
|
||||
{
|
||||
_songs.add(song);
|
||||
@ -290,6 +291,14 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
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
|
||||
@ -1002,7 +1011,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
{
|
||||
if (event.getGadget() != null && event.getGadget().getGadgetType() == GadgetType.MusicDisc)
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Hub", "Music Discs are disabled right now"));
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Hub", "Music Discs are disabled right now!"));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -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<ServerManager, QuickShop>
|
||||
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));
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Mineplex.PlayerCache</name>
|
||||
<name>Mineplex.Cache</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.playerCache;
|
||||
package mineplex.cache.player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.playerCache;
|
||||
package mineplex.cache.player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -15,6 +15,7 @@ import mineplex.core.monitor.LagMeter;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.profileCache.ProfileCacheManager;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
@ -88,6 +89,8 @@ public class StaffServer extends JavaPlugin
|
||||
|
||||
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20"));
|
||||
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp"));
|
||||
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo"));
|
||||
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo"));
|
||||
|
||||
new ProfileCacheManager(this);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.Core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.ClassCombat"/>
|
||||
|
@ -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
|
||||
|
@ -45,6 +45,7 @@ import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.poll.PollManager;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.profileCache.ProfileCacheManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
@ -160,6 +161,8 @@ public class Arcade extends JavaPlugin
|
||||
new PacketsInteractionFix(this, packetHandler);
|
||||
new FoodDupeFix(this);
|
||||
|
||||
new ProfileCacheManager(this);
|
||||
|
||||
//Updates
|
||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
||||
|
||||
|
@ -308,8 +308,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
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
|
||||
|
@ -302,7 +302,7 @@ public abstract class Game implements Listener
|
||||
public boolean DeadBodiesQuit = true;
|
||||
public boolean DeadBodiesDeath = true;
|
||||
public int DeadBodiesExpire = -1;
|
||||
|
||||
|
||||
public boolean EnableTutorials = false;
|
||||
|
||||
public boolean FixSpawnFacing = true;
|
||||
@ -1726,6 +1726,6 @@ public abstract class Game implements Listener
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addTutorials(){}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class GameTeam
|
||||
{
|
||||
Host = host;
|
||||
|
||||
_displayName = name;
|
||||
_displayName = null;
|
||||
_name = name;
|
||||
_color = color;
|
||||
_spawns = spawns;
|
||||
@ -181,7 +181,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);
|
||||
}
|
||||
@ -195,7 +195,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();
|
||||
@ -326,6 +326,9 @@ public class GameTeam
|
||||
|
||||
public String getDisplayName()
|
||||
{
|
||||
if (_displayName == null)
|
||||
return _name;
|
||||
|
||||
return _displayName;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
@ -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
|
||||
|
@ -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.",
|
||||
|
||||
}));
|
||||
|
||||
|
@ -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;
|
||||
|
@ -71,11 +71,8 @@ public class GameManager implements Listener
|
||||
if (event.getType() != UpdateType.MIN_08)
|
||||
return;
|
||||
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
if (!Manager.GetGame().IsAlive(player))
|
||||
if ((Manager.getName() == null || !Manager.GetGame().IsAlive(player)) && !Manager.getPreferences().Get(player).DisableAds)
|
||||
{
|
||||
player.sendMessage(C.cWhite + " ");
|
||||
player.sendMessage(C.cRedB + " MASSIVE WINTER SALE");
|
||||
|
@ -54,10 +54,10 @@ public class WorldData
|
||||
|
||||
public GameType Game = null;
|
||||
|
||||
public HashMap<String, ArrayList<Location>> SpawnLocs = new HashMap<String, ArrayList<Location>>();
|
||||
private HashMap<String, ArrayList<Location>> DataLocs = new HashMap<String, ArrayList<Location>>();
|
||||
private HashMap<String, ArrayList<Location>> CustomLocs = new HashMap<String, ArrayList<Location>>();
|
||||
private final Map<String, String> _dataEntries = new HashMap<>();
|
||||
public HashMap<String, ArrayList<Location>> SpawnLocs = new LinkedHashMap<String, ArrayList<Location>>();
|
||||
private HashMap<String, ArrayList<Location>> DataLocs = new LinkedHashMap<String, ArrayList<Location>>();
|
||||
private HashMap<String, ArrayList<Location>> CustomLocs = new LinkedHashMap<String, ArrayList<Location>>();
|
||||
private final Map<String, String> _dataEntries = new LinkedHashMap<>();
|
||||
|
||||
public WorldData(Game game)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user