Merge remote-tracking branch 'refs/remotes/origin/develop' into update/hub-makeover

This commit is contained in:
Sam 2017-09-09 09:19:46 +01:00
commit c729857a00
95 changed files with 1300 additions and 587 deletions

View File

@ -78,6 +78,7 @@ public class SkinData
public static final SkinData LARISSA = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTc0NjE0MTUxMzQsInByb2ZpbGVJZCI6Ijg1MmE4YWNmNzMzNzQwZDc5OWVjYjA4ZmQ5OTY1MGI1IiwicHJvZmlsZU5hbWUiOiJLaW5nQ3JhenlfIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9jYThjNDRhOWVmZTY3NzExMDYzMjM5ODEwNDRmOTdjYmM1OWJmZmRlOGI1ODdlMGQzMWE4N2ViMDhhMmExZiJ9fX0=", "Lyac51CrnMK/CI2dWgGQLowAm/ZnQMpf0Ict/gqVrUgJVlGWDIVG77Rd1JyMQDEeESvTmoyivH+usiO0ePW95qjisqT3R43YEmLi85CqctGYqLKeSYpGYwYRz8Euw57LwJAALKOMLhVc2s4h2Or9nTecunG8KSmkCuZc4H1qh3frU+ltuV4HLqgdFUULbIHTggyvqiINov2tBqkkXeEjT7sOcTJCJNgNYU2O7//qg5kJmhso2CKHlRLpmy9LsaUK/Z+BzUmoRbwQgSwr3mz7dFAdlVWWKvKNcgX3nt1et0DIig3JKYmrnQX2Fprg+kWcr3nuizzLgjVwAlADC48P3DN0s/VBty2AYoWie16VNPIM+CV4BF2JRQ34GxZ8XceXbCKURrOjoCBgLGHvIhRW35eicoh26xp3/mwLvk5anPi5StJ/qEuzWJALeWcNbLsnt21m2MZp9h/MxaY6ftWOTzjTr5CYVd/teJyscMnGK4+lcV1dlt12lhbDMv6I+iz8iG9NIzuW5OvGkax90dA/Gq+Cd9FXVThPY4ufxWttHcTqgPB64GfMn6rywRm1B0eO1pJpYc/KlJZlW/PuaO8L1assyJs5KkOypBSy3zc6TO6pzgeOZv+VpQfA/UWpogv6ofmTpgdtwpjLFGSzIKTDXvF6FftALKVlYypG0fYbssA=");
public static final SkinData ROWENA = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTc0Njk1MTcxOTgsInByb2ZpbGVJZCI6Ijg1MmE4YWNmNzMzNzQwZDc5OWVjYjA4ZmQ5OTY1MGI1IiwicHJvZmlsZU5hbWUiOiJLaW5nQ3JhenlfIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9jNDY1OGExODY4YzNhNjhhZWVhZmZkOTUxZDQyYmZkN2QxYTRjNGZjNDJjZDI2YTlmYzhkNTNmOTkxMTM1ZCJ9fX0=", "OqXMyH9SMmQ/Pwmb21In29YnCxbsN6yqUxfudN6KNgDwRUK6y072XhW6TIoTh9JQLAUKftpeVB53tk0LxHIxnsuBMrIHvETPDQFysIc/6xq3ABogs+zqFzcp5jk6S73HiD78JxLq5pzfUzhgDPMPuZP5Q/u2q1rYbe6B9lVEJ5sUcxBLUTossgucoR4qXYAlWVQdHRhq85Ol8a+OU7ruw3HackNGto6wt6u2MigCtiHVTt9XhJ/AJE4ScodQ3XwW4L6urpl/lV2OMCsr3mCjjjEz2EMhDbCWxrAorQ9aPpMbDkHBS+4TC1tbMGUlKhj5n+EZBYVaeLr4NGPACPSdT35p/2Zra49+DXn9Xn+681yNEB0ghTdsnsgwXg76+HVPHPqRHQMuTBQGQyGZaaTX/zE0tFjH+osMElLdb8dmz3dC7kQA4A13B2phj3YbMSF1FoU4GvnPKIQn6JIuEd6hd+pRLUW7Y+mgYIHHX1FT0ihrXAyVO6lQQ6rs92gSQr7sxC7tnhPSMFcmh7OcJYcbRpn97GMubthPLanOhVy7CKqjmwIkEVtYgP28idigKwNJ+sJuUONrOu7nMKl1UTD5EEapOacc/np6UhdSw8yW+LnWD/x9ueYz9ksnyRrJgcOa41izo/WCbjPK/j3JVezr9Q3x1yveWuFmdl7CGYdXngw=");
public static final SkinData BIFF = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTc0NjEzMDQzNjYsInByb2ZpbGVJZCI6Ijg1MmE4YWNmNzMzNzQwZDc5OWVjYjA4ZmQ5OTY1MGI1IiwicHJvZmlsZU5hbWUiOiJLaW5nQ3JhenlfIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9mOWMyMTE3ZDY0ZWE0ZmUxMWZiY2NhZmE2YzU5YzhlZjY3NDVkZjVkMTZjM2QwMmI4NmI2OTlmZWJjNTA0OGI1In19fQ==", "mJMpEvQ4A02z0S/chgLm5bKrrrd+zmp7A0012AB7b3KlyIHoLKEDDz+ZJgJtvN6skOqed3P+yNVqkxitugXaZZP8Af9J+/TseHn+vOy6CTK5tykRSY3Zb8Zmw1kn36v/SARAVtDIHD53yuPgJayYSAbVB7aknj1Q8XBQGUmZRMRxWWxeD7rQTOwgRYI4YJeKFf4UL9i6zxvOJuHsOAouJ7scu7VohG8vgR77Js/Z8rSu8/aSG+O9AQdzP6h9ixYNFkkQOHm7DseK/5tsWKHM4FYBgjIDKt3ApQokSbhThzGB55BA1qjXZkfCoOb13y1nOMC8WoIL6Ees1qzxG3VloGx2WAZLh+Q+/irwrFDMxk1zeU5fIRuj1c/UIM2HKdxxWgoRdrZ8ww/Jrll6maiOBx7geMn/0aOUbJ2U7gkTif6RG6YNS5YN9ZQDLh72l/akJMxF3SlmuAPmLs2kBghQ6eD2YQKuxWR/Hf1yS1YXtogFVNsGnzC1nda7F48EGL3zI+kCajbDlAGQ32aRt0btbEQ+Gj575kir3Aa53qiZ0YOIYQlhgZdOsTN2NE2s8uuy/15Rgc6K3ydgEmSZfdqyMyW0Dy7pE5TfVL8DumKRVRXdOceT5WfnW7MyqSmdorP5ab1fw2wLOnAVzhJmW8oXXNSs77WJ1/PURclxOWB4IF8=");
public static final SkinData IVY = new SkinData("eyJ0aW1lc3RhbXAiOjE1MDQ5MTg0MTMxNTksInByb2ZpbGVJZCI6IjI2YTVmMDc5ZTNkOTRkZGY5YzdjMjc4NTcxNGIzZWU2IiwicHJvZmlsZU5hbWUiOiJFMDgiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJtZXRhZGF0YSI6eyJtb2RlbCI6InNsaW0ifSwidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9hYjM0N2NhZWI0OTZlMTc0NDZiNjhlNGFmYmFjN2Y5YTNiMGE5ZTBhODI0MjAxNTM1ZGY3NDc4YmNkNzJjYSJ9fX0=", "rtQw9X3Xzekqfqiy/L7/2YH8+fLdH1jzGoDoKd2nC0c/h7IK/FfQOqC6odwDrW5liPf/VKrCTgl6uUWchOczmBeR4la6lvJMIY3Lz59qAWEfm7VHYSqiu6wYMfHWQpDU4N1Ethy4oridsavr3EAiGrONZmlGoGtZkMWt1/IEMJaH5SwVnFPkYaHVDiHrQkQ1Izlr5ZBG9SkpdhSnnviHq3swMhw6WKoBxS7jb6WXSzdwVQE5Bt0z4J2iWjZosJRKssd47T10w7Me/F+8kbgNozIp98ga99iC/moRrQxDuvrCpxdGAmjw5xq0TXprrZW04PdU2SFiZwyKgtpVpr9lDNNUCfMkkSzpaHiLXlrNvHK4M9BBo6mn2RerpA1ABBryPCcniAvPB8OEx7ktWSDN+708ZJ6u+9DelEzxfK7MTcJQkKln0T7ktxKXDafX0ALYkCLFMWKInuDSXsIgklCH/vtGLbYXdDdpwvTRMsKt+QCb7K/xMMqLgRylc4ae6i3MYCWJxi9KGRhZclrjsMacpAl8a+kS+RJdfJa8HKl7yKpEGClblQQ6vKfCNVok4neLzVJ+6OpPiHUcX6S66Lqt2cJ/aaKuouRLB7/gy+bCTT7SLxboLxw7EQkakBd2BXa3hK3LHKqoYkAmJAUrr/jl7Z/gjXzASvrak2kzR9ZNVqg=");
public static final SkinData CANADA_HAT = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTg2MDE5MDYwNzYsInByb2ZpbGVJZCI6IjdkYTJhYjNhOTNjYTQ4ZWU4MzA0OGFmYzNiODBlNjhlIiwicHJvZmlsZU5hbWUiOiJHb2xkYXBmZWwiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2M2MTExNTNmODdmMjZjMzRmOTdkODIxM2ZmOTk1ZGJlNjcyZWJkNGM0NjRkNGFkNzM5MWFlNDNjMWU3YTllIn19fQ", "QMw6e1FXl/Xrt+BbfPKsz3OHyOxL9CEPffS9grxRLD6gbLbMD84OT3+bge5V9lBFn9PPnTyID+WTF24qHj4ADTTgK94ykNedCEO6R1wS0FZKPI1UjwOxMhIG5ZeVr7+HxITgGU4Xz94IigBkvW//f2ZGelMvS0GLCrm4iCovEBMUzyYJ2dZ4xgzFSH6v+9efK4/SBAJaj8mHjXpDxU58/vskTGI3T9t5sWlZLXgId9vHcMj0GH3Un6yvUXiMkh38V/rAEM8/R8q08xUVyW0e2R38qWQV2+eKvsG8GmJmgkU/78wA9cKGZdrEz0pnr80eGNCbvXqQvC/czYhEhDapgxfndcHLX8q/Zk3I8msNr340E4ZrQL61Yl7KcVC1qEUQVu3cosq5A6ckXLGvv//HSwXVO8M9ThUbuEC8QjiS/fMFufnVa18lHrVulnfb/2KQ4yPsoCHK/zvGtRkWtD1sLOIfehN+sxCLiaz80ILBiwN0oHITfNHpJzoa4kF/OrxxCualp4Sv5o5TXBv7aWsO18v9ixb9o9CmJKKE8MUl5xmRVz4HQD4dyOfcwtPuxmfcYjJrxqBijdQMrcgLzqqMs+DUqcZZlxM7M5GaNUoEvL9tJNGpZaB2OrBw0DTk5wx15XfANCH4egx8X4+Iy2RUoFthHX3BsVazG7fjSiDnUtI=");
public static final SkinData AMERICA_HAT = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTg2MDI3MjMyODgsInByb2ZpbGVJZCI6IjNlMjZiMDk3MWFjZDRjNmQ5MzVjNmFkYjE1YjYyMDNhIiwicHJvZmlsZU5hbWUiOiJOYWhlbGUiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzYzMjI0MDhkYzBiZjMxNjU4N2RiNDJiN2Q5ZmViZTUwYWQ4MGY0OGU4Njc5YzI0NTFkOTk3MTdjZmVjNTdkYWQifX19","oRo6DIuhOTaXDkFsgwJ488LWqx5d1QpwtglwG1SdEvkbX1aCMGdZyDm9YIopQRjfBg0uYKQFetOZ1ZkdMmc/aKC5/dm0+Ema7g8AUzjwf4OaSLH1r4C1UJ4ruaNG5diBxNTkYnMa7yT8zvyEr22CA7lUOIgTh8ymBfSGK35RPhsn8jM0hDjdhjemBAlxKpiioByfmAQbwokNBOrXfh/PnKq+iJYg4WpMSZ1zo5Rr0CzLXwu+/T3dvrb6mg7qry7J3Lj5/qn6iIdBcjJBeyvy1sCo45jQ3Rzc6oL/84Vu5Dpn395EqUK8Sa7mdpVpATTcj56TCjkNNtDapXNqyO/IIQuzU4wnBKNQmZefaxRl6LV0DhZ8n8YQaPj6hH/mr2oDsd23+jejjqu6Y95ReTyukp06mIGqgekmrdZV2etML2oMAOTv9ieVvqtfo5gEomYs+NFAL7rMmzjAlhd17VOgqNRMpmJazAHWOYKl8KdOH99wGDe5XcyKHysh+qyHKMvhPJztIeAEaosynF/aGHghH2PM354KCuUVNmdR5G7UZUoG9ZA5ZU3EzZ854jeqxcqw3jzb6qL7A83QNuFqOsb87ugL/jO3QEDdQ9drdf3WAQauQGkU3nYBrls5wxoMrQ+Ceth+FtZw9a1v7dc+DEWOeJKCtOAIskb29pv6OcRe0Wk=");
public static final SkinData REVOLUTIONARY = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTg3ODQ5Mzk3NjAsInByb2ZpbGVJZCI6ImIwZDRiMjhiYzFkNzQ4ODlhZjBlODY2MWNlZTk2YWFiIiwicHJvZmlsZU5hbWUiOiJZZWxlaGEiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2I4NTBkZDNkYWQ0MjkxYzFhYmU4NGU2OTM2ZmQ3MDM0ZWVlZTk1OTk2MWI3YjE5NDZhODIxYWRlMTFiODI2YjIifX19","U2xBG+ryUacvZq3WreWF2J4QnQERuvp1okqdlkAYECqvVHz0cars78usPuZYD4s3HyOM0eGASzS4zkQERF6Hk8crnG+ZtqvML5kL+TkxK8gEbn2j5qB+YDG0qTx635mYGC77sGaqE/CsZAlhRYU6lyXILW2616Af8B8orOlpyCMRytijp/OfJREK0bC4I1QnB7AJ2QmBYuZJ9l8473858fJOlCVHjbsC/WRcUvepPSYYxvl8Z5NwayyIVnnz3tGVN6hnM7tzil/gQmsmDwGhlSyify/MEGssvd0sHLTlccA7XX98tyUFHXU84L5MJuNKg/uXTYz+9cRPIgJaptJNfqCoEa/ape+YHlOlK2lm5qRvubvp931X+VwFbcrEuaIFgbqr9cof5JW6DYfpVKvcngi9+K9IzgtPG59Jro5kxb70IfQhZcDkcHGo1pz5Tj7cdJdD7crBeIBaE/EoKU6iaSOrUFoILEdpcWQfaToRnk4L/JMet7zPXBNE/D/vEgQLGLNX7byofdCXSD9njtjLWmHg4rCzwuUqaiWnTCYIkkdg/mFuRQ3oTRRTzdlLXsK90Pz0XU9N6gBhWA9pxhzDJR7YK+mdXODALuMXE6zcCsbVuWhqbnN+EByGdjT9X1QPSN+/5iV9d5JyweiJrF7arf2PmxgEIb9OSjePNKRmHoo=");

View File

@ -42,7 +42,7 @@ public class AccountRepository extends MinecraftRepository
private static String CREATE_RANKS_TABLE = "CREATE TABLE IF NOT EXISTS accountRanks (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, rankIdentifier VARCHAR(40), primaryGroup BOOL, PRIMARY KEY(id), INDEX accountIndex (accountId), INDEX rankIndex (rankIdentifier), UNIQUE INDEX additionalIndex (accountId, rankIdentifier, primaryGroup), FOREIGN KEY (accountId) REFERENCES accounts(id));";
private static String UPDATE_PRIMARY_RANK = "UPDATE accountRanks SET rankIdentifier=? WHERE accountId=? AND primaryGroup=true;";
private static String ADD_PRIMARY_RANK = "INSERT INTO accountRanks (accountId, rankIdentifier, primaryGroup) VALUES (?, NULL, true);";
private static String ADD_PRIMARY_RANK = "INSERT INTO accountRanks (accountId, rankIdentifier, primaryGroup) VALUES (?, 'NULL', true);";
private static String ADD_ADDITIONAL_RANK = "INSERT INTO accountRanks (accountId, rankIdentifier, primaryGroup) VALUES (?, ?, false);";
private static String REMOVE_ADDITIONAL_RANK = "DELETE FROM accountRanks WHERE accountId=? AND rankIdentifier=? AND primaryGroup=false;";
private static String REMOVE_ADDITIONAL_RANKS = "DELETE FROM accountRanks WHERE accountId=? AND primaryGroup=false;";
@ -100,11 +100,10 @@ public class AccountRepository extends MinecraftRepository
statement.execute("SELECT * FROM accountRanks WHERE accountId=" + accountId + ";");
try (ResultSet rankSet = statement.getResultSet())
{
boolean anyRows = false;
while (rankSet.next())
{
anyRows = true;
PermissionGroup group = PermissionGroup.valueOf(rankSet.getString("rankIdentifier"));
String identifier = rankSet.getString("rankIdentifier");
PermissionGroup group = identifier.equals("NULL") ? null : PermissionGroup.valueOf(identifier);
boolean primary = rankSet.getBoolean("primaryGroup");
if (primary)
@ -112,14 +111,12 @@ public class AccountRepository extends MinecraftRepository
primaryRank = group;
}
else
{
if (group != null)
{
extraRanks.add(group);
}
}
if (!anyRows)
{
statement.execute(UPDATE_PRIMARY_RANK.replace("?", "" + accountId));
}
}
@ -239,7 +236,7 @@ public class AccountRepository extends MinecraftRepository
{
if (!rs.next() || rs.getInt(1) == 0)
{
s.execute(ADD_PRIMARY_RANK.replace("?", "" + accountId));
s.execute(ADD_PRIMARY_RANK.replace("?", String.valueOf(accountId)));
}
}
@ -341,13 +338,7 @@ public class AccountRepository extends MinecraftRepository
{
try (Statement s = c.createStatement())
{
try (ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM accountRanks WHERE accountId=" + accountId + " AND primaryGroup=true;"))
{
if (!rs.next())
{
s.execute(ADD_PRIMARY_RANK.replace("?", "" + accountId));
}
}
int primaryFound = 0;
try (ResultSet rs = s.executeQuery("SELECT * FROM accountRanks WHERE accountId=" + accountId + ";"))
{
while (rs.next())
@ -356,11 +347,19 @@ public class AccountRepository extends MinecraftRepository
{
removed.add(PermissionGroup.valueOf(rs.getString("rankIdentifier")));
}
else
{
primaryFound++;
}
}
}
if (primaryFound < 1)
{
s.execute(ADD_PRIMARY_RANK.replace("?", String.valueOf(accountId)));
}
}
executeUpdate(c, UPDATE_PRIMARY_RANK, () -> {}, new ColumnVarChar("rankIdentifier", 255, "PLAYER"), new ColumnInt("accountId", accountId));
executeUpdate(c, UPDATE_PRIMARY_RANK, () -> {}, new ColumnVarChar("rankIdentifier", 255, PermissionGroup.PLAYER.name()), new ColumnInt("accountId", accountId));
executeUpdate(c, REMOVE_ADDITIONAL_RANKS, () -> success.set(false), new ColumnInt("accountId", accountId));
}
catch (SQLException e)
@ -405,9 +404,16 @@ public class AccountRepository extends MinecraftRepository
while (rs.next())
{
if (rs.getBoolean("primaryGroup"))
{
if (rs.getString("rankIdentifier").equals("NULL"))
{
primary.set(null);
}
else
{
primary.set(PermissionGroup.valueOf(rs.getString("rankIdentifier")));
}
}
else
{
additional.add(PermissionGroup.valueOf(rs.getString("rankIdentifier")));

View File

@ -108,10 +108,15 @@ public class AntiHack extends MiniPlugin
.put(FastBow.class, new CheckThresholds("FastBow", 10, 20, 30))
.build();
public static final Map<Class<? extends Check>, CheckThresholds> STRICT_CHECKS = ImmutableMap.<Class<? extends Check>, CheckThresholds>builder()
.put(Glide.class, new CheckThresholds("Flying", 600, 1200, 1600))
.put(Speed.class, new CheckThresholds("Speed", 600, 1200, 1600))
.build();
private static final CheckThresholds NOOP_THRESHOLD = new CheckThresholds("Unknown", Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
public static final Map<Class<? extends Check>, AntiHackAction> ACTIONS = ImmutableMap.<Class<? extends Check>, AntiHackAction>builder()
.put(KillauraTypeA.class, new ImmediateBanAction(200))
.put(KillauraTypeA.class, new ImmediateBanAction(150))
.put(KillauraTypeD.class, new BanwaveAction(1500))
.put(KillauraTypeF.class, new BanwaveAction(600))
.put(Glide.class, new ImmediateBanAction(7500))
@ -123,6 +128,11 @@ public class AntiHack extends MiniPlugin
.put(KillauraTypeB.class, new GEPBanAction(100))
.build();
public static final Map<Class<? extends Check>, AntiHackAction> STRICT_ACTIONS = ImmutableMap.<Class<? extends Check>, AntiHackAction>builder()
.put(Glide.class, new ImmediateBanAction(2200))
.put(Speed.class, new ImmediateBanAction(2200))
.build();
private static final AntiHackAction NOOP_ACTION = new NoopAction();
private static final String NAME = "Chiss";
@ -475,9 +485,15 @@ public class AntiHack extends MiniPlugin
return;
}
ACTIONS.getOrDefault(event.getCheckClass(), NOOP_ACTION).handle(event);
CheckThresholds thresholds = CHECKS.getOrDefault(event.getCheckClass(), NOOP_THRESHOLD);
AntiHackAction action = ACTIONS.getOrDefault(event.getCheckClass(), NOOP_ACTION);
if (_strict)
{
thresholds = STRICT_CHECKS.getOrDefault(event.getCheckClass(), thresholds);
action = STRICT_ACTIONS.getOrDefault(event.getCheckClass(), action);
}
action.handle(event);
CheckThresholds.Severity severity = thresholds.getSeverity(event.getViolations());
if (severity == CheckThresholds.Severity.NONE)

View File

@ -69,12 +69,6 @@ public class CosmeticManager extends MiniPlugin
_shop = new CosmeticShop(this, clientManager, donationManager, _moduleName);
}
/*@Override
public void addCommands()
{
addCommand(new CosmeticsSlackCommand(this));
}*/
public void showInterface(boolean showInterface)
{
boolean changed = _showInterface == showInterface;
@ -244,9 +238,9 @@ public class CosmeticManager extends MiniPlugin
return _punish;
}
public void displayUI(Player player)
public CosmeticShop getShop()
{
_shop.attemptShopOpen(player);
return _shop;
}
public void disableTeamArmor()

View File

@ -3,10 +3,8 @@ package mineplex.core.cosmetic.ui.page;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
@ -17,9 +15,7 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuit;
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksSuit;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
public class CostumePage extends GadgetPage
@ -92,21 +88,4 @@ public class CostumePage extends GadgetPage
addBackButton();
}
public void activateGadget(Player player, Gadget gadget)
{
if (gadget instanceof ItemGadget)
{
if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.getName()) <= 0)
{
purchaseGadget(player, gadget);
return;
}
}
playAcceptSound(player);
gadget.enable(player);
buildPage();
}
}

View File

@ -122,15 +122,10 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
protected void addBackButton(int slot)
{
addButton(4, new ShopItem(Material.BED, C.cGreen + "Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)));
addButton(slot, new ShopItem(Material.BED, C.cGreen + "Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)));
}
protected void addGadget(Gadget gadget, int slot)
{
addGadget(gadget, slot, false);
}
protected void addGadget(Gadget gadget, int slot, boolean locked)
{
boolean owns = gadget.ownsGadget(getPlayer());
int shardCost = gadget.getCost(GlobalCurrency.TREASURE_SHARD);
@ -161,7 +156,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
}
}
if (!owns || locked)
if (!owns)
{
int displayedShardCost = shardCost;
@ -300,7 +295,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
addCustomLore(gadget, itemLore);
if (owns && !locked)
if (owns)
{
ItemStack gadgetItemStack;
@ -421,7 +416,6 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
public void handleRightClick(Player player, Gadget gadget)
{
player.sendMessage("Preview?");
}
public void deactivateGadget(Player player, Gadget gadget)

View File

@ -36,11 +36,6 @@ public class ItemGadgetPage extends GadgetPage
@Override
public void purchaseGadget(Player player, Gadget gadget)
{
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) <= 0)
{
return;
}
ItemGadget itemGadget = (ItemGadget) gadget;
if (itemGadget.getAmmo() != null && itemGadget.getAmmo().getCost(GlobalCurrency.TREASURE_SHARD) <= 0)

View File

@ -1,7 +1,5 @@
package mineplex.core.cosmetic.ui.page;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
@ -14,7 +12,6 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BannerMeta;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilServer;
@ -58,21 +55,10 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
@Override
protected void buildPage()
{
// Treasure Shards
int treasureShards = getDonationManager().Get(getPlayer()).getBalance(GlobalCurrency.TREASURE_SHARD);
List<String> shardLore = new ArrayList<>();
shardLore.add(" ");
shardLore.add(C.cGray + "These seem like they might come in");
shardLore.add(C.cGray + "handy. Maybe I should collect more!");
ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false);
int deathSlot = 19;
int jumpSlot = 28;
int particleSlot = 1;
int winEffectSlot = 13;
int shardSlot = 22;
int arrowSlot = 10;
int tauntSlot = 31;
int gameModifierSlot = 21;
@ -86,9 +72,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
int flagSlot = 34;
int morphSlot = 25;
int costumeSlot = 16;
int powerPlaySlot = 40;
addItem(shardSlot, shards);
int powerPlaySlot = 22;
EnumMap<GadgetType, Integer> ownedCount = new EnumMap<>(GadgetType.class);
EnumMap<GadgetType, Integer> maxCount = new EnumMap<>(GadgetType.class);

View File

@ -1,5 +1,11 @@
package mineplex.core.cosmetic.ui.page.gamemodifiers;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
@ -7,10 +13,8 @@ import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticCategory;
import mineplex.core.gadget.types.GameModifierGadget;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.ShopItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
public class GameCosmeticGadgetPage extends GadgetPage
{
@ -20,7 +24,7 @@ public class GameCosmeticGadgetPage extends GadgetPage
public GameCosmeticGadgetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, GameCosmeticCategoryPage previousMenu, GameCosmeticCategory category)
{
super(plugin, shop, clientManager, donationManager, name, player, null);
super(plugin, shop, clientManager, donationManager, name, player);
_previousMenu = previousMenu;
_category = category;
@ -31,18 +35,21 @@ public class GameCosmeticGadgetPage extends GadgetPage
@Override
protected void buildPage()
{
int slot = 10;
super.buildPage();
for (GameModifierGadget gadget : _category.getGadgets())
if (_previousMenu != null)
{
addGadget(gadget, slot);
if (++slot % 9 == 8)
addButton(4, new ShopItem(Material.BED, C.cGreen + "Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), _previousMenu));
}
else
{
slot += 2;
removeButton(4);
}
}
addButton(4, new ShopItem(Material.BED, C.cGreen + " Go Back", new String[]{}, 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), _previousMenu));
@Override
protected List<Gadget> getGadgetsToDisplay()
{
return new ArrayList<>(_category.getGadgets());
}
}

View File

@ -53,7 +53,7 @@ public class HeroSkinCategoryPage extends GadgetPage
public HeroSkinCategoryPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, GameCosmeticCategoryPage previousMenu)
{
super(plugin, shop, clientManager, donationManager, name, player, null);
super(plugin, shop, clientManager, donationManager, name, player);
_previousMenu = previousMenu;
@ -99,6 +99,6 @@ public class HeroSkinCategoryPage extends GadgetPage
addButton(slots[index++], itemStack, (player, clickType) -> getShop().openPageForPlayer(player, new HeroSkinGadgetPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), name, getPlayer(), this, gadgetDataList)));
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), _previousMenu));
addButton(4, new ShopItem(Material.BED, C.cGreen + "Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), _previousMenu));
}
}

View File

@ -22,7 +22,7 @@ public class HeroSkinGadgetPage extends GadgetPage
HeroSkinGadgetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, GadgetPage previousMenu, List<HeroSkinGadgetData> gadgetData)
{
super(plugin, shop, clientManager, donationManager, name, player, null);
super(plugin, shop, clientManager, donationManager, name, player);
_previousMenu = previousMenu;
_gadgetData = gadgetData;
@ -45,6 +45,6 @@ public class HeroSkinGadgetPage extends GadgetPage
}
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), _previousMenu));
addButton(4, new ShopItem(Material.BED, C.cGreen + "Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), _previousMenu));
}
}

View File

@ -46,6 +46,7 @@ import mineplex.core.gadget.commands.AmmoCommand;
import mineplex.core.gadget.commands.LockCosmeticsCommand;
import mineplex.core.gadget.commands.UnlockCosmeticsCommand;
import mineplex.core.gadget.event.GadgetChangeEvent;
import mineplex.core.gadget.event.GadgetChangeEvent.GadgetState;
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.event.GadgetEnableEvent;
import mineplex.core.gadget.event.PlayerToggleSwimEvent;
@ -105,8 +106,6 @@ import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.GemHuntersMountGadg
import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.GemHuntersMountType;
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStrikeSkin;
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin;
import mineplex.core.gadget.gadgets.gamemodifiers.moba.emblems.EmblemGadget;
import mineplex.core.gadget.gadgets.gamemodifiers.moba.emblems.EmblemType;
import mineplex.core.gadget.gadgets.gamemodifiers.moba.shopmorph.ShopMorphGadget;
import mineplex.core.gadget.gadgets.gamemodifiers.moba.shopmorph.ShopMorphType;
import mineplex.core.gadget.gadgets.gamemodifiers.moba.skins.HeroSkinGadget;
@ -170,6 +169,7 @@ import mineplex.core.gadget.gadgets.morph.managers.SwimManager;
import mineplex.core.gadget.gadgets.morph.moba.MorphAnath;
import mineplex.core.gadget.gadgets.morph.moba.MorphBardolf;
import mineplex.core.gadget.gadgets.morph.moba.MorphBiff;
import mineplex.core.gadget.gadgets.morph.moba.MorphIvy;
import mineplex.core.gadget.gadgets.morph.moba.MorphDana;
import mineplex.core.gadget.gadgets.morph.moba.MorphDevon;
import mineplex.core.gadget.gadgets.morph.moba.MorphHattori;
@ -422,7 +422,8 @@ public class GadgetManager extends MiniPlugin
{
PermissionGroup.QA.setPermission(Perm.LOCK_COSMETICS_COMMAND, true, true);
PermissionGroup.QA.setPermission(Perm.UNLOCK_COSMETICS_COMMAND, true, true);
} else
}
else
{
PermissionGroup.ADMIN.setPermission(Perm.LOCK_COSMETICS_COMMAND, true, true);
PermissionGroup.ADMIN.setPermission(Perm.UNLOCK_COSMETICS_COMMAND, true, true);
@ -564,6 +565,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new MorphRowena(this));
addGadget(new MorphLarissa(this));
addGadget(new MorphBiff(this));
addGadget(new MorphIvy(this));
// Mounts
addGadget(new MountUndead(this));
@ -850,17 +852,17 @@ public class GadgetManager extends MiniPlugin
}
}
};
new GameCosmeticCategory(this, "Emblems", new ItemStack(Material.NETHER_STAR), false)
{
@Override
public void addGadgets()
{
for (EmblemType type : EmblemType.values())
{
addGameGadget(new EmblemGadget(getManager(), this, type));
}
}
};
// new GameCosmeticCategory(this, "Emblems", new ItemStack(Material.NETHER_STAR), false)
// {
// @Override
// public void addGadgets()
// {
// for (EmblemType type : EmblemType.values())
// {
// addGameGadget(new EmblemGadget(getManager(), this, type));
// }
// }
// };
}
};
@ -1475,55 +1477,10 @@ public class GadgetManager extends MiniPlugin
private void saveGadget(GadgetChangeEvent event)
{
Gadget gadget = event.getGadget();
if (gadget != null)
{
String value = "disabled", key;
GadgetType gadgetType = gadget.getGadgetType();
switch (gadgetType)
{
case MUSIC_DISC:
case ITEM:
case MORPH:
case BALLOON:
case MOUNT:
return;
case COSTUME:
OutfitGadget outfitGadget = (OutfitGadget) gadget;
key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey();
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
{
value = outfitGadget.getName();
}
break;
case GAME_MODIFIER:
GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget;
GameCosmeticCategory category = gameModifierGadget.getCategory();
if (category.isAllowingMultiple())
{
key = gameModifierGadget.getName();
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
{
value = "enabled";
}
}
else
{
key = "active" + category.getType().getName().replace(" ", "");
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
{
value = gameModifierGadget.getName();
}
}
break;
default:
key = gadgetType.getDatabaseKey();
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
{
value = gadget.getName();
}
}
_userGadgetPersistence.save(event.getPlayer(), key, value);
_userGadgetPersistence.save(event.getPlayer(), gadget, event.getGadgetState() == GadgetState.ENABLED);
}
}

View File

@ -15,13 +15,10 @@ import mineplex.core.pet.PetType;
public class LockCosmeticsCommand extends CommandBase<GadgetManager>
{
private GadgetManager _plugin;
public LockCosmeticsCommand(GadgetManager plugin)
{
super(plugin, GadgetManager.Perm.LOCK_COSMETICS_COMMAND, "lockCosmetics");
_plugin = plugin;
}
@Override
@ -38,7 +35,7 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
if (player != null)
{
removeCosmetics(null, player);
UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Removed all the cosmetics to " + F.name(player.getName()) + "!"));
UtilPlayer.message(caller, F.main(Plugin.getName(), "Removed all the cosmetics to " + F.name(player.getName()) + "!"));
}
}
}
@ -54,9 +51,9 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
removePets(caller);
return;
}
Donor donor = _plugin.getDonationManager().Get(caller);
Donor donor = Plugin.getDonationManager().Get(caller);
int removed = 0;
for (Gadget gadget : _plugin.getGadgets(gadgetType))
for (Gadget gadget : Plugin.getGadgets(gadgetType))
{
if (gadget != null)
{
@ -77,7 +74,7 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
}
}
}
UtilPlayer.message(caller, F.main("Lock Cosmetics", "Removed " + removed + F.elem(" " + gadgetType.getCategoryType()) + UtilText.plural(" item", removed) + "!"));
UtilPlayer.message(caller, F.main(Plugin.getName(), "Removed " + removed + F.elem(" " + gadgetType.getCategoryType()) + UtilText.plural(" item", removed) + "!"));
}
private void removePets(Player caller)
@ -85,11 +82,11 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
int removed = 0;
for (PetType pet : PetType.values())
{
if (_plugin.getPetManager().Get(caller).getPets().remove(pet) != null)
if (Plugin.getPetManager().Get(caller).getPets().remove(pet) != null)
{
removed++;
}
}
UtilPlayer.message(caller, F.main("Lock Cosmetics", "Removed " + removed + UtilText.plural(" pet", removed) + "!"));
UtilPlayer.message(caller, F.main(Plugin.getName(), "Removed " + removed + UtilText.plural(" pet", removed) + "!"));
}
}

View File

@ -17,13 +17,9 @@ import mineplex.core.pet.PetType;
public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
{
private GadgetManager _plugin;
public UnlockCosmeticsCommand(GadgetManager plugin)
{
super(plugin, GadgetManager.Perm.UNLOCK_COSMETICS_COMMAND, "unlockCosmetics");
_plugin = plugin;
}
@Override
@ -43,7 +39,7 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
if (player != null)
{
addCosmetics(null, player);
UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Added all the cosmetics to " + F.name(player.getName()) + "!"));
UtilPlayer.message(caller, F.main(Plugin.getName(), "Added all the cosmetics to " + F.name(player.getName()) + "!"));
}
}
}
@ -55,7 +51,7 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
if (player != null)
{
addCosmetics(null, player);
UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Added all the cosmetics to " + F.name(player.getName()) + "!"));
UtilPlayer.message(caller, F.main(Plugin.getName(), "Added all the cosmetics to " + F.name(player.getName()) + "!"));
}
}
}
@ -73,9 +69,9 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
addPets(caller);
return;
}
Donor donor = _plugin.getDonationManager().Get(caller);
Donor donor = Plugin.getDonationManager().Get(caller);
int added = 0;
for (Gadget gadget : _plugin.getGadgets(gadgetType))
for (Gadget gadget : Plugin.getGadgets(gadgetType))
{
if (gadget.isHidden())
{
@ -103,7 +99,7 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
added++;
}
}
UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Added " + added + F.elem(" " + gadgetType.getCategoryType()) + UtilText.plural(" item", added) + "!"));
UtilPlayer.message(caller, F.main(Plugin.getName(), "Added " + added + F.elem(" " + gadgetType.getCategoryType()) + UtilText.plural(" item", added) + "!"));
}
private void addPets(Player caller)
@ -111,12 +107,12 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
int added = 0;
for (PetType pet : PetType.values())
{
if (!_plugin.getPetManager().Get(caller).getPets().containsKey(pet))
if (!Plugin.getPetManager().Get(caller).getPets().containsKey(pet))
{
_plugin.getPetManager().Get(caller).getPets().put(pet, pet.getName());
Plugin.getPetManager().Get(caller).getPets().put(pet, pet.getName());
added++;
}
}
UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Added " + added + UtilText.plural(" pet", added) + "!"));
UtilPlayer.message(caller, F.main(Plugin.getName(), "Added " + added + UtilText.plural(" pet", added) + "!"));
}
}

View File

@ -3,8 +3,10 @@ package mineplex.core.gadget.gadgets.gamemodifiers;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.cosmetic.ui.page.gamemodifiers.GameCosmeticCategoryPage;
import mineplex.core.cosmetic.ui.page.gamemodifiers.GameCosmeticGadgetPage;
@ -43,6 +45,11 @@ public abstract class GameCosmeticCategory
_manager.addGadget(gadget);
}
public GadgetPage getGadgetPage(CosmeticManager manager, Player player)
{
return new GameCosmeticGadgetPage(manager, manager.getShop(), _manager.getClientManager(), _manager.getDonationManager(), _categoryName, player, null, this);
}
public GadgetPage getGadgetPage(GameCosmeticCategoryPage parent)
{
return new GameCosmeticGadgetPage(parent.getPlugin(), parent.getShop(), parent.getClientManager(), parent.getDonationManager(), _categoryName, parent.getClient().GetPlayer(), parent, this);

View File

@ -19,6 +19,7 @@ import mineplex.core.gadget.types.GameModifierGadget;
import mineplex.core.game.GameDisplay;
@ReflectivelyCreateMiniPlugin
// TODO Remove all the string literals for cosmetic categories
public class GameCosmeticManager extends MiniPlugin
{
@ -133,7 +134,7 @@ public class GameCosmeticManager extends MiniPlugin
return gadgetsCloned;
}
private GameCosmeticCategory getCategoryFrom(GameDisplay gameType, String categoryName)
public GameCosmeticCategory getCategoryFrom(GameDisplay gameType, String categoryName)
{
if (gameType == null || categoryName == null)
{

View File

@ -12,12 +12,13 @@ public class GemHuntersMountGadget extends GameModifierGadget
private final GemHuntersMountType _type;
// An alternative package name of "Clans " + name is due to mounts from the store originally just for clans being available on more platforms.
public GemHuntersMountGadget(GadgetManager manager, GameCosmeticCategory category, GemHuntersMountType type)
{
super(manager, category, type.getName() + " Mount", new String[] {
super(manager, category, type.getName(), new String[]{
C.cGray + "Changed your active Mount",
C.cGray + "in " + F.greenElem("Gem Hunters") + " to " + type.getName() + ".",
}, CostConstants.PURCHASED_FROM_STORE, type.getMaterial(), type.getMaterialData());
}, CostConstants.PURCHASED_FROM_STORE, type.getMaterial(), type.getMaterialData(), "Clans " + type.getName());
_type = type;
}

View File

@ -1,26 +1,235 @@
package mineplex.core.gadget.gadgets.gamemodifiers.gemhunters;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Horse.Color;
import org.bukkit.entity.Horse.Style;
import org.bukkit.entity.Horse.Variant;
import mineplex.core.Managers;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseCow;
import mineplex.core.disguise.disguises.DisguiseSheep;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.utils.UtilVariant;
public enum GemHuntersMountType
{
DONKEY("Donkey", Material.CHEST)
INFERNAL_HORROR("Infernal Horror Mount Skin", Material.BONE)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
return UtilVariant.spawnHorse(location, Variant.SKELETON_HORSE);
}
@Override
public void onUpdate(UpdateEvent event, Horse horse)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
UtilParticle.PlayParticleToAll(ParticleType.FLAME, horse.getLocation().add(0, 1, 0), 0.25F, 0.25F, 0.25F, 0, 2, ViewDist.NORMAL);
}
},
GLACIAL_STEED("Glacial Steed Mount Skin", Material.SNOW_BALL)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
Horse horse = UtilVariant.spawnHorse(location, Variant.HORSE);
horse.setColor(Color.WHITE);
horse.setStyle(Style.WHITE);
return horse;
}
@Override
public void onUpdate(UpdateEvent event, Horse horse)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
UtilParticle.PlayParticleToAll(ParticleType.SNOW_SHOVEL, horse.getLocation().add(0, 1, 0), 0.25F, 0.25F, 0.25F, 0.1F, 4, ViewDist.NORMAL);
}
},
ZOMBIE_HORSE("Zombie Horse Mount Skin", Material.ROTTEN_FLESH)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
return UtilVariant.spawnHorse(location, Variant.UNDEAD_HORSE);
}
@Override
public void onUpdate(UpdateEvent event, Horse horse)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
UtilParticle.PlayParticleToAll(ParticleType.FOOTSTEP, horse.getLocation().add(0, 0.2, 0), null, 0, 1, ViewDist.NORMAL);
}
},
RAINBOW_SHEEP("Rainbow Sheep Mount Skin", Material.WOOL, 14)
{
private DisguiseManager _disguise = Managers.get(DisguiseManager.class);
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
Horse horse = UtilVariant.spawnHorse(location, Variant.HORSE);
manager.disguise(new DisguiseSheep(horse));
return horse;
}
@Override
public void onUpdate(UpdateEvent event, Horse horse)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
DisguiseBase base = _disguise.getActiveDisguise(horse);
if (base == null || !(base instanceof DisguiseSheep))
{
return;
}
DisguiseSheep sheep = (DisguiseSheep) base;
int mod = horse.getTicksLived() % 40;
if (mod == 0) sheep.setColor(DyeColor.RED);
else if (mod == 1) sheep.setColor(DyeColor.YELLOW);
else if (mod == 2) sheep.setColor(DyeColor.GREEN);
else if (mod == 3) sheep.setColor(DyeColor.BLUE);
}
},
ROYAL_STEED("Royal Steed Mount Skin", Material.GOLD_BARDING)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
Horse horse = UtilVariant.spawnHorse(location, Variant.HORSE);
horse.setColor(Color.WHITE);
horse.setStyle(Style.WHITE);
return horse;
}
@Override
public void onUpdate(UpdateEvent event, Horse horse)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
UtilParticle.PlayParticleToAll(ParticleType.BLOCK_DUST.getParticle(Material.GOLD_BLOCK, 0), horse.getLocation().add(0, 1, 0), 0.25F, 0.25F, 0.25F, 0, 3, ViewDist.NORMAL);
}
},
ROYAL_GUARD_STEED("Royal Guard Steed Mount Skin", Material.DIAMOND_BARDING)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
Horse horse = UtilVariant.spawnHorse(location, Variant.HORSE);
horse.setColor(Color.WHITE);
horse.setStyle(Style.WHITE);
return horse;
}
@Override
public void onUpdate(UpdateEvent event, Horse horse)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
UtilParticle.PlayParticleToAll(ParticleType.BLOCK_DUST.getParticle(Material.IRON_BLOCK, 0), horse.getLocation().add(0, 1, 0), 0.25F, 0.25F, 0.25F, 0, 3, ViewDist.NORMAL);
}
},
KNIGHT_STEED("Knight Steed Mount Skin", Material.DIAMOND_BARDING)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
Horse horse = UtilVariant.spawnHorse(location, Variant.HORSE);
horse.setColor(Color.GRAY);
horse.setStyle(Style.NONE);
return horse;
}
@Override
public void onUpdate(UpdateEvent event, Horse horse)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.APPLE, 0), horse.getLocation().add(0, 1, 0), 0.25F, 0.25F, 0.25F, 0, 3, ViewDist.NORMAL);
}
},
COW("Cow Mount Skin", Material.MILK_BUCKET)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
Horse horse = UtilVariant.spawnHorse(location, Variant.HORSE);
manager.disguise(new DisguiseCow(horse));
return horse;
}
},
SHEEP("Sheep Mount Skin", Material.WOOL)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
Horse horse = UtilVariant.spawnHorse(location, Variant.HORSE);
manager.disguise(new DisguiseSheep(horse));
return horse;
}
},
TRUSTY_MULE("Trusty Mule Mount Skin", Material.APPLE)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
return UtilVariant.spawnHorse(location, Variant.DONKEY);
}
},
};
;
private final String _name;
private final Material _material;

View File

@ -33,7 +33,7 @@ public enum EmblemType
public String getName()
{
return _name;
return _name + " Emblem";
}
public String getSchematic()

View File

@ -109,7 +109,7 @@ public enum ShopMorphType
public String getName()
{
return _name;
return _name + " Shop Skin";
}
public Material getMaterial()

View File

@ -59,6 +59,22 @@ public class HeroSkinGadget extends GameModifierGadget
return skinData;
}
private static String[] getDescription(HeroSkinGadgetData skinData)
{
boolean hasDescription = !skinData.getDescription().isEmpty();
String[] description = new String[hasDescription ? 3 : 2];
description[0] = C.cGray + "Rarity: " + skinData.getRarity().getColor() + skinData.getRarity().getName();
description[1] = "";
if (hasDescription)
{
description[2] = C.cGray + ChatColor.translateAlternateColorCodes('&', skinData.getDescription());
}
return description;
}
private final HeroSkinGadgetData _gadgetData;
public HeroSkinGadget(GadgetManager manager, GameCosmeticCategory category, HeroSkinGadgetData skinData)
@ -68,7 +84,7 @@ public class HeroSkinGadget extends GameModifierGadget
public HeroSkinGadget(GadgetManager manager, GameCosmeticCategory category, HeroSkinGadgetData skinData, int cost)
{
super(manager, category, skinData.getName(), new String[]{C.cGray + "Rarity: " + skinData.getRarity().getColor() + skinData.getRarity().getName(), "", C.cGray + ChatColor.translateAlternateColorCodes('&', skinData.getDescription())}, cost, Material.GLASS, (byte) 0);
super(manager, category, skinData.getName() + " (" + skinData.getHero() + ")", getDescription(skinData), cost, Material.GLASS, (byte) 0);
setDisplayItem(skinData.getSkinData().getSkull());
skinData.setGadget(this);

View File

@ -41,12 +41,6 @@ public class ItemEtherealPearl extends ItemGadget
500, new Ammo("Ethereal Pearl", "50 Pearls", Material.ENDER_PEARL, (byte)0, new String[] { C.cWhite + "50 Pearls to get around with!" }, 500, 50));
}
@Override
public void disableCustom(Player player, boolean message)
{
super.disableCustom(player, message);
}
@Override
public void ActivateCustom(Player player)
{

View File

@ -14,6 +14,7 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
@ -70,6 +71,6 @@ public class ItemFirework extends ItemGadget
UtilFirework.launchFirework(loc,
FireworkEffect.builder().flicker(Math.random() > 0.5).withColor(color).with(type).trail(Math.random() > 0.5).build(),
new Vector(0,0,0), 0 + (int)(Math.random()*3));
new Vector(0,0,0), UtilMath.r(3) + 1);
}
}

View File

@ -54,8 +54,8 @@ public class MorphAnath extends MorphGadget
public MorphAnath(GadgetManager manager)
{
super(manager, "Anath", UtilText.splitLinesToArray(new String[]{
C.cGray + "TODO make a description",
super(manager, "Anath Morph", UtilText.splitLinesToArray(new String[]{
C.cGray + "BURN BEAM!!!!",
"",
C.cGreen + "Click" + C.cWhite + " your " + C.cYellow + "Fireball" + C.cWhite + " to",
C.cWhite + "fire out a huge wave of",

View File

@ -65,8 +65,8 @@ public class MorphBardolf extends MorphGadget
public MorphBardolf(GadgetManager manager)
{
super(manager, "Bardolf", UtilText.splitLinesToArray(new String[]{
C.cGray + "TODO make a description",
super(manager, "Bardolf Morph", UtilText.splitLinesToArray(new String[]{
C.cGray + "Play fetch with 5 puppers of your very own!",
"",
C.cGreen + "Click" + C.cWhite + " your " + C.cYellow + "Bone" + C.cWhite + " to",
C.cWhite + "play " + C.cYellow + "Fetch" + C.cWhite + " with your wolves!"

View File

@ -50,8 +50,8 @@ public class MorphBiff extends MorphGadget
public MorphBiff(GadgetManager manager)
{
super(manager, "Biff", UtilText.splitLinesToArray(new String[]{
C.cGray + "TODO make description",
super(manager, "Biff Morph", UtilText.splitLinesToArray(new String[]{
C.cGray + "REEEEEEEEEEEEEEEE",
"",
C.cGreen + "Click" + C.cWhite + " your " + C.cYellow + "Nether Star" + C.cWhite + " to",
C.cWhite + "mount your " + C.cYellow + "Horse" + C.cWhite + " and",

View File

@ -67,8 +67,8 @@ public class MorphDana extends MorphGadget
public MorphDana(GadgetManager manager)
{
super(manager, "Dana", UtilText.splitLinesToArray(new String[]{
C.cGray + "TODO make a description",
super(manager, "Dana Morph", UtilText.splitLinesToArray(new String[]{
C.cGray + "Get pranked chest opener.",
"",
C.cGreen + "Click" + C.cWhite + " your " + C.cYellow + "Nether Star" + C.cWhite + " to",
C.cWhite + "deploy your " + C.cYellow + "Rally" + C.cWhite + ".",

View File

@ -50,7 +50,7 @@ public class MorphDevon extends MorphGadget
public MorphDevon(GadgetManager manager)
{
super(manager, "Devon", UtilText.splitLinesToArray(new String[]{
super(manager, "Devon Morph", UtilText.splitLinesToArray(new String[]{
C.cGray + "You thought this was overpowered in game?",
C.cGray + "Well now you shoot TNT",
C.cGray + "at unsuspecting players in the hub!",
@ -108,7 +108,7 @@ public class MorphDevon extends MorphGadget
return;
}
if (!Recharge.Instance.use(player, "TNT Infusion", 1000, false, true, "Cosmetics"))
if (!Recharge.Instance.use(player, "TNT Infusion", 2000, false, true, "Cosmetics"))
{
event.setCancelled(true);
return;

View File

@ -46,7 +46,7 @@ public class MorphHattori extends MorphGadget
public MorphHattori(GadgetManager manager)
{
super(manager, "Hattori", UtilText.splitLinesToArray(new String[]{
super(manager, "Hattori Morph", UtilText.splitLinesToArray(new String[]{
C.cGray + "Ever wanted to dash around",
C.cGray + "the hub like a Ninja?",
C.cGray + "Well now you can!",

View File

@ -0,0 +1,131 @@
package mineplex.core.gadget.gadgets.morph.moba;
import java.util.concurrent.TimeUnit;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import com.mojang.authlib.GameProfile;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilText;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.gadget.util.CostConstants;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
import mineplex.core.utils.UtilGameProfile;
public class MorphIvy extends MorphGadget
{
private static final ItemStack ACTIVE_ITEM = new ItemBuilder(Material.VINE)
.setTitle(C.cGreenB + "Ivy's Flower Display")
.addLore("Click to fire out a beam of water that knocks back", "players that it hits.")
.build();
private static final int ACTIVE_SLOT = 2;
private static final int RADIUS = 5;
private static final long DURATION = TimeUnit.SECONDS.toMillis(8);
public MorphIvy(GadgetManager manager)
{
super(manager, "Ivy Morph", UtilText.splitLinesToArray(new String[]{
C.cGray + "Roses are red, violets are violet.",
"",
C.cGreen + "Click" + C.cWhite + " your " + C.cYellow + "Vines" + C.cWhite + " to",
C.cWhite + "create a " + C.cYellow + "Flower" + C.cWhite + " display.",
}, LineFormat.LORE), CostConstants.FOUND_IN_MOBA_CHESTS, Material.GLASS, (byte) 0);
setDisplayItem(SkinData.IVY.getSkull());
}
@Override
public void enableCustom(Player player, boolean message)
{
applyArmor(player, message);
GameProfile gameProfile = UtilGameProfile.getGameProfile(player);
gameProfile.getProperties().clear();
gameProfile.getProperties().put("textures", SkinData.IVY.getProperty());
DisguisePlayer disguisePlayer = new DisguisePlayer(player, gameProfile);
disguisePlayer.showInTabList(true, 0);
UtilMorph.disguise(player, disguisePlayer, Manager);
player.getInventory().setItem(ACTIVE_SLOT, ACTIVE_ITEM);
}
@Override
public void disableCustom(Player player, boolean message)
{
removeArmor(player);
UtilMorph.undisguise(player, Manager.getDisguiseManager());
player.getInventory().setItem(ACTIVE_SLOT, null);
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
if (event.getAction() == Action.PHYSICAL)
{
return;
}
Player player = event.getPlayer();
ItemStack itemStack = event.getItem();
if (!isActive(player) || itemStack == null || !itemStack.equals(ACTIVE_ITEM))
{
return;
}
event.setCancelled(true);
if (!Recharge.Instance.use(player, "Floral Display", 16000, true, true, "Cosmetics"))
{
return;
}
Location location = player.getLocation();
for (Block block : UtilBlock.getInRadius(location, RADIUS).keySet())
{
if (block.getType() != Material.AIR || UtilBlock.airFoliage(block.getRelative(BlockFace.DOWN)))
{
continue;
}
Manager.getBlockRestore().add(block, Material.RED_ROSE.getId(), (byte) (UtilMath.r(8) + 1), DURATION + (UtilMath.rRange(-500, 500)));
if (Math.random() > 0.7)
{
block.getWorld().playEffect(block.getLocation().add(0.5, 0.5, 0.5), Effect.STEP_SOUND, Material.RED_ROSE);
}
}
}
@EventHandler
public void blockPhysics(BlockPhysicsEvent event)
{
if (event.getChangedType() == Material.RED_ROSE)
{
event.setCancelled(true);
}
}
}

View File

@ -42,8 +42,8 @@ public class MorphLarissa extends MorphGadget
public MorphLarissa(GadgetManager manager)
{
super(manager, "Larissa", UtilText.splitLinesToArray(new String[]{
C.cGray + "TODO make description",
super(manager, "Larissa Morph", UtilText.splitLinesToArray(new String[]{
C.cGray + "Become a water mage and splash your enemies away!",
"",
C.cGreen + "Click" + C.cWhite + " your " + C.cYellow + "Wand" + C.cWhite + " to fire",
C.cWhite + "a beam of " + C.cWhite + "Water" + C.cWhite + " that",
@ -96,7 +96,7 @@ public class MorphLarissa extends MorphGadget
event.setCancelled(true);
if (!Recharge.Instance.use(player, "Aqua Cannon", 4000,true, true, "Cosmetics"))
if (!Recharge.Instance.use(player, "Aqua Cannon", 4000, true, true, "Cosmetics"))
{
return;
}

View File

@ -43,8 +43,8 @@ public class MorphRowena extends MorphGadget
public MorphRowena(GadgetManager manager)
{
super(manager, "Rowena", UtilText.splitLinesToArray(new String[]{
C.cGray + "TODO make description",
super(manager, "Rowena Morph", UtilText.splitLinesToArray(new String[]{
C.cGray + "Make the hub a little brighter with Rowena's Light Arrows.",
"",
C.cGreen + "Shoot" + C.cWhite + " your " + C.cYellow + "Bow" + C.cWhite + " to fire",
C.cWhite + "arrows to be imbued with " + C.cYellow + "Light" + C.cWhite + ".",
@ -99,7 +99,7 @@ public class MorphRowena extends MorphGadget
event.setCancelled(true);
if (!Recharge.Instance.use(player, "Light Arrows", 1000, false, true, "Cosmetics"))
if (!Recharge.Instance.use(player, "Light Arrows", 500, false, true, "Cosmetics"))
{
return;
}

View File

@ -155,7 +155,8 @@ public abstract class Mount<T extends MountData> extends Gadget
UtilAction.velocity(part, direction, 1.2, false, 0, 0.8, 10, true);
}
direction.multiply(-1);
direction.setX(-direction.getX());
direction.setZ(-direction.getZ());
for (Entity part : otherParts)
{

View File

@ -1,19 +1,15 @@
package mineplex.core.gadget.persistence;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.*;
import org.bukkit.entity.Player;
import mineplex.core.common.util.BukkitFuture;
import mineplex.core.common.util.F;
import mineplex.core.database.PlayerKeyValueRepository;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticCategory;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GameModifierGadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.GameModifierGadget;
import mineplex.core.gadget.types.OutfitGadget;
import org.bukkit.entity.Player;
public class UserGadgetPersistence
{
@ -24,19 +20,22 @@ public class UserGadgetPersistence
public UserGadgetPersistence(GadgetManager manager)
{
_manager = manager;
_repository = new PlayerKeyValueRepository<>("gadgets", PreparedStatement::setString, ResultSet::getString);
_repository = new PlayerKeyValueRepository<>("gadgets", String.class);
}
public void load(Player player)
{
_repository.getAll(player.getUniqueId()).thenCompose(BukkitFuture.accept(values -> {
_repository.getAll(player.getUniqueId()).thenCompose(BukkitFuture.accept(values ->
{
if (player.isOnline())
{
boolean enabledGadget = false;
for (Gadget gadget : _manager.getAllGadgets())
{
if (!gadget.ownsGadget(player))
{
continue;
}
GadgetType gadgetType = gadget.getGadgetType();
switch (gadgetType)
{
@ -54,7 +53,6 @@ public class UserGadgetPersistence
if (values.get(key).equals(gadget.getName()))
{
gadget.enable(player, false);
enabledGadget = true;
}
break;
case GAME_MODIFIER:
@ -68,48 +66,95 @@ public class UserGadgetPersistence
if (values.get(gadget.getName()).equals("enabled"))
{
gadget.enable(player, false);
enabledGadget = true;
}
}
else
{
String dataKey = "active" + category.getType().getName().replace(" ", "");
if (!values.containsKey(dataKey))
key = "active" + category.getType().getName().replace(" ", "") + category.getCategoryName().replace(" ", "");
if (!values.containsKey(key))
continue;
if (values.get(dataKey).equals(gadget.getName()))
if (values.get(key).equals(gadget.getName()))
{
gadget.enable(player, false);
enabledGadget = true;
}
}
break;
default:
if (!values.containsKey(gadgetType.getDatabaseKey()))
{
continue;
}
if (values.get(gadgetType.getDatabaseKey()).equals(gadget.getName()))
{
gadget.enable(player, false);
enabledGadget = true;
}
break;
}
}
if (enabledGadget)
{
player.sendMessage(F.main("Cosmetics", "You enabled all your previously enabled cosmetics!"));
}
}
}));
}
public void save(Player player, Map<String, String> values)
public void save(Player player, Gadget gadget, boolean enabled)
{
_repository.putAll(player.getUniqueId(), values);
String value = "disabled", key;
GadgetType gadgetType = gadget.getGadgetType();
switch (gadgetType)
{
case MUSIC_DISC:
case ITEM:
case MORPH:
case BALLOON:
case MOUNT:
return;
case COSTUME:
OutfitGadget outfitGadget = (OutfitGadget) gadget;
key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey();
if (enabled)
{
value = outfitGadget.getName();
}
break;
case GAME_MODIFIER:
GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget;
GameCosmeticCategory category = gameModifierGadget.getCategory();
if (category.isAllowingMultiple())
{
key = gameModifierGadget.getName();
if (enabled)
{
value = "enabled";
}
}
else
{
key = "active" + category.getType().getName().replace(" ", "") + category.getCategoryName().replace(" ", "");
if (enabled)
{
value = gameModifierGadget.getName();
}
}
break;
default:
key = gadgetType.getDatabaseKey();
if (enabled)
{
value = gadget.getName();
}
}
public void save(Player player, String key, String value)
if (!enabled)
{
_repository.remove(player.getUniqueId(), key);
}
else
{
_repository.put(player.getUniqueId(), key, value);
}
}
}

View File

@ -13,9 +13,9 @@ public class GameModifierGadget extends Gadget
private final GameCosmeticCategory _category;
public GameModifierGadget(GadgetManager manager, GameCosmeticCategory category, String name, String[] desc, int cost, Material mat, byte data)
public GameModifierGadget(GadgetManager manager, GameCosmeticCategory category, String name, String[] desc, int cost, Material mat, byte data, String... alternativePackageNames)
{
super(manager, GadgetType.GAME_MODIFIER, name, desc, cost, mat, data);
super(manager, GadgetType.GAME_MODIFIER, name, desc, cost, mat, data, 1, alternativePackageNames);
_category = category;
}
@ -23,14 +23,21 @@ public class GameModifierGadget extends Gadget
@Override
public void enableCustom(Player player, boolean message)
{
_active.add(player);
if (message)
if (_active.add(player) && message)
{
UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.name(getName()) + " (" + F.name(_category.getCategoryName()) + ")."));
}
}
@Override
public void disableCustom(Player player, boolean message)
{
if (_active.remove(player) && message)
{
UtilPlayer.message(player, F.main(Manager.getName(), "You disabled " + F.name(getName()) + " (" + F.name(_category.getCategoryName()) + ")."));
}
}
public GameCosmeticCategory getCategory()
{
return _category;

View File

@ -62,6 +62,7 @@ import mineplex.core.gadget.gadgets.flag.FlagType;
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin;
import mineplex.core.gadget.gadgets.gamemodifiers.moba.skins.HeroSkinGadget;
import mineplex.core.gadget.gadgets.gamemodifiers.moba.shopmorph.ShopMorphType;
import mineplex.core.gadget.gadgets.gamemodifiers.moba.skins.HeroSkinGadgetData;
import mineplex.core.gadget.gadgets.hat.HatType;
import mineplex.core.gadget.gadgets.item.ItemBatGun;
import mineplex.core.gadget.gadgets.item.ItemBow;
@ -99,6 +100,7 @@ import mineplex.core.gadget.gadgets.morph.MorphVillager;
import mineplex.core.gadget.gadgets.morph.moba.MorphAnath;
import mineplex.core.gadget.gadgets.morph.moba.MorphBardolf;
import mineplex.core.gadget.gadgets.morph.moba.MorphBiff;
import mineplex.core.gadget.gadgets.morph.moba.MorphIvy;
import mineplex.core.gadget.gadgets.morph.moba.MorphDana;
import mineplex.core.gadget.gadgets.morph.moba.MorphDevon;
import mineplex.core.gadget.gadgets.morph.moba.MorphHattori;
@ -377,31 +379,33 @@ public class RewardManager
// INFUSED CHESTS
// for (ShopMorphType shopMorphType : ShopMorphType.values())
// {
// if (shopMorphType.getRarity() == rarity)
// {
// addMOBAShopSkin(Type.MOBA, shopMorphType, rarity, 1);
// }
// }
addMOBAShopSkin(Type.MOBA, ShopMorphType.SHEEP, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.COW, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.MOOSHROOM, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.PIG, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.HORSE, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.SNOW_GOLEM, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.IRON_GOLEM, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.ZOMBIE, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.SKELETON, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.SPIDER, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.SLIME, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.MAGMA_SLIME, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.WITHER_SKELETON, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.PIG_ZOMBIE, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.WITCH, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.BLAZE, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.GUARDIAN, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.ENDERMAN, rarity, 1);
for (ShopMorphType shopMorphType : ShopMorphType.values())
{
if (shopMorphType.getRarity() == rarity)
{
addMOBAShopSkin(Type.MOBA, shopMorphType, rarity, 1);
}
}
// addMOBAShopSkin(Type.MOBA, ShopMorphType.SHEEP, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.COW, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.MOOSHROOM, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.PIG, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.HORSE, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.SNOW_GOLEM, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.IRON_GOLEM, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.ZOMBIE, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.SKELETON, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.SPIDER, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.SLIME, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.MAGMA_SLIME, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.WITHER_SKELETON, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.PIG_ZOMBIE, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.WITCH, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.BLAZE, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.GUARDIAN, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.ENDERMAN, rarity, 1);
addAllMOBASkins(rarity);
}
public void addRare()
@ -702,16 +706,18 @@ public class RewardManager
addGadget(Type.ILLUMINATED, getSingleParticleKitSelector(SingleParticleKitSelector.SingleParticleSelectors.FLAMES_OF_FURY), rarity, 150);
addGadget(Type.MYTHICAL, getSingleParticleKitSelector(SingleParticleKitSelector.SingleParticleSelectors.FLAMES_OF_FURY), rarity, 150);
// for (ShopMorphType shopMorphType : ShopMorphType.values())
// {
// if (shopMorphType.getRarity() == rarity)
// {
// addMOBAShopSkin(Type.MOBA, shopMorphType, rarity, 1);
// }
// }
addMOBAShopSkin(Type.MOBA, ShopMorphType.SANTA, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.BOB_ROSS, rarity, 1);
addMOBAShopSkin(Type.MOBA, ShopMorphType.REVOLUTIONARY, rarity, 1);
for (ShopMorphType shopMorphType : ShopMorphType.values())
{
if (shopMorphType.getRarity() == rarity)
{
addMOBAShopSkin(Type.MOBA, shopMorphType, rarity, 1);
}
}
// addMOBAShopSkin(Type.MOBA, ShopMorphType.SANTA, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.BOB_ROSS, rarity, 1);
// addMOBAShopSkin(Type.MOBA, ShopMorphType.REVOLUTIONARY, rarity, 1);
addAllMOBASkins(rarity);
}
public void addLegendary()
@ -1029,6 +1035,9 @@ public class RewardManager
addGadget(Type.MOBA, getGadget(MorphRowena.class), rarity, 1);
addGadget(Type.MOBA, getGadget(MorphLarissa.class), rarity, 1);
addGadget(Type.MOBA, getGadget(MorphBiff.class), rarity, 1);
addGadget(Type.MOBA, getGadget(MorphIvy.class), rarity, 1);
addAllMOBASkins(rarity);
}
public UnknownPackageReward addMount(Type type, Mount<?> mount, RewardRarity rarity, int weight)
@ -1114,6 +1123,27 @@ public class RewardManager
return addGadget(type, gadget, gadget.getDisplayName() + " (Minestrike Weapon Skin)", rarity, weight, shards);
}
private void addAllMOBASkins(RewardRarity rarity)
{
HeroSkinGadget.getSkins().forEach((name, dataList) ->
{
if (name.equals("Bardolf-Werewolf"))
{
return;
}
dataList.forEach(data ->
{
if (data.getRarity() != rarity)
{
return;
}
addMOBASkin(Type.MOBA, data.getGadget(), rarity, 1);
});
});
}
public UnknownPackageReward addMOBASkin(Type type, HeroSkinGadget gadget, RewardRarity rarity, int weight)
{
return addMOBASkin(type, gadget, rarity, weight, getShards(rarity));

View File

@ -23,7 +23,7 @@ public enum RewardType
VALENTINES_GIFT( 0, 7, 20, 20),
ST_PATRICKS( 0, 6, 18, 0),
SPRING( 0, 6, 18, 0),
MOBA( 0, 5, 25, 40),
MOBA( 0, 5, 20, 30),
SPINNER_FILLER( 0.1, 1, 4, 20),
SPINNER_REAL( 0.000001, 0.05, 0.4, 5);

View File

@ -33,7 +33,8 @@ public class CastleSiegeTesterTrack extends Track
"7b133339-2e02-48ef-9dd4-692415933dc5", // Kreshyy
"4e941b23-6e36-48cb-97c4-24f56ea128c1", // DooDooBug25
"0a4b6d83-8eb0-46aa-bc0f-9b7f04046d52", // Livicus
"4f8f5380-ffe1-418d-97a4-0737c6edf352" // Hils
"4f8f5380-ffe1-418d-97a4-0737c6edf352", // Hils
"e873e1c7-8e7d-4489-84e1-74b86e1b4ba7" // Dutty
);
public CastleSiegeTesterTrack()

View File

@ -39,7 +39,7 @@ public enum TreasureType
SPRING(C.cGreen + "Spring Treasure", "Spring Chest", "SpringChest", RewardType.SPRING, Material.CHEST, TreasureStyle.SPRING, RewardPool.Type.SPRING, true, 20000),
MOBA(C.cAqua + "Heroes of GWEN Treasure", "HOG Chest", "HOGChest", RewardType.MOBA, Material.ENDER_CHEST, TreasureStyle.MOBA, RewardPool.Type.MOBA, false, -1),
MOBA(C.cAqua + "Heroes of GWEN Treasure", "HOG Chest", "HOGChest", RewardType.MOBA, Material.ENDER_CHEST, TreasureStyle.MOBA, RewardPool.Type.MOBA, true, 12000),
;
private final String _name;

View File

@ -504,7 +504,9 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
}
else
{
mobaLore.add(C.cAqua + "Earn HOG Chests by leveling up Roles with in Heroes of GWEN.");
mobaLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + TreasureType.MOBA.getPurchasePrice() + " Treasure Shards");
mobaLore.add(" ");
mobaLore.add(C.cAqua + "or Earn HOG Chests by leveling up Roles with in Heroes of GWEN.");
}
ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false);

View File

@ -179,9 +179,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
KIT_UNLOCK_COMMAND,
TAUNT_COMMAND,
GAME_COMMAND,
SET_GAME_COMMAND,
START_GAME_COMMAND,
STOP_GAME_COMMAND,
AUTO_OP,
KIT_ACCESS,
FEATURED_SERVER,
@ -627,19 +624,10 @@ public class ArcadeManager extends MiniPlugin implements IRelation
PermissionGroup.CONTENT.setPermission(Perm.KIT_UNLOCK_COMMAND, true, true);
PermissionGroup.PLAYER.setPermission(Perm.TAUNT_COMMAND, true, true);
PermissionGroup.ADMIN.setPermission(Perm.GAME_COMMAND, true, true);
PermissionGroup.ADMIN.setPermission(Perm.SET_GAME_COMMAND, true, true);
PermissionGroup.ADMIN.setPermission(Perm.START_GAME_COMMAND, true, true);
PermissionGroup.ADMIN.setPermission(Perm.STOP_GAME_COMMAND, true, true);
if (UtilServer.isTestServer())
{
PermissionGroup.QA.setPermission(Perm.GAME_COMMAND, true, true);
PermissionGroup.QA.setPermission(Perm.SET_GAME_COMMAND, true, true);
PermissionGroup.QA.setPermission(Perm.START_GAME_COMMAND, true, true);
PermissionGroup.QA.setPermission(Perm.STOP_GAME_COMMAND, true, true);
PermissionGroup.MAPLEAD.setPermission(Perm.GAME_COMMAND, false, true);
PermissionGroup.MAPLEAD.setPermission(Perm.SET_GAME_COMMAND, false, true);
PermissionGroup.MAPLEAD.setPermission(Perm.START_GAME_COMMAND, false, true);
PermissionGroup.MAPLEAD.setPermission(Perm.STOP_GAME_COMMAND, false, true);
}
if (UtilServer.isTestServer() || UtilServer.isDevServer())
{
@ -925,6 +913,17 @@ public class ArcadeManager extends MiniPlugin implements IRelation
return true;
}
public boolean canPlayerUseGameCmd(Player player)
{
if (!GetClients().Get(player).hasPermission(Perm.GAME_COMMAND) && !(_gameHostManager.isEventServer() && _gameHostManager.isAdmin(player, false)))
{
player.sendMessage(F.main("Game", "You are not allowed to use game commands."));
return false;
}
return true;
}
@EventHandler
public void StaffIncognito(IncognitoStatusChangeEvent event)
{

View File

@ -3,6 +3,8 @@ package nautilus.game.arcade.command;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.command.MultiCommandBase;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
@ -14,21 +16,31 @@ import static nautilus.game.arcade.command.SetCommand.SOURCE_PREFIX;
public class GameCommand extends MultiCommandBase<ArcadeManager>
{
public enum Perm implements Permission
{
GAME_COMMAND_DUMMY_PERM,
}
public GameCommand(ArcadeManager plugin)
{
super(plugin, ArcadeManager.Perm.GAME_COMMAND, "game");
super(plugin, Perm.GAME_COMMAND_DUMMY_PERM, "game");
AddCommand(new StartCommand(Plugin));
AddCommand(new StopCommand(Plugin));
AddCommand(new SetCommand(Plugin));
PermissionGroup.PLAYER.setPermission(Perm.GAME_COMMAND_DUMMY_PERM, true, true);
}
@Override
protected void Help(Player caller, String[] args)
{
if (!Plugin.canPlayerUseGameCmd(caller))
{
UtilPlayer.message(caller, F.main("Game", "Available Commands"));
UtilPlayer.message(caller, F.help("/game start", "Start the current game", ChatColor.DARK_RED));
UtilPlayer.message(caller, F.help("/game stop", "Stop the current game", ChatColor.DARK_RED));
caller.sendMessage(F.help(String.format("/game set <gametype> [%s(gamemode)] [%s(mapsource)] [%s(mapname)]", MODE_PREFIX, SOURCE_PREFIX, MAP_PREFIX), "Set the current game or next game", ChatColor.DARK_RED));
}
}
}

View File

@ -26,12 +26,17 @@ public class SetCommand extends CommandBase<ArcadeManager>
public SetCommand(ArcadeManager plugin)
{
super(plugin, ArcadeManager.Perm.SET_GAME_COMMAND, "set");
super(plugin, GameCommand.Perm.GAME_COMMAND_DUMMY_PERM, "set");
}
@Override
public void Execute(Player caller, String[] args)
{
if (!Plugin.canPlayerUseGameCmd(caller))
{
return;
}
if (Plugin.GetGame() == null)
return;

View File

@ -13,12 +13,17 @@ public class StartCommand extends CommandBase<ArcadeManager>
{
public StartCommand(ArcadeManager plugin)
{
super(plugin, ArcadeManager.Perm.START_GAME_COMMAND, "start");
super(plugin, GameCommand.Perm.GAME_COMMAND_DUMMY_PERM, "start");
}
@Override
public void Execute(Player caller, String[] args)
{
if (!Plugin.canPlayerUseGameCmd(caller))
{
return;
}
if (Plugin.GetGame() == null || Plugin.GetGame().GetState() == GameState.Loading)
{
UtilPlayer.message(caller, F.main("Game", "The game is currently loading, it cannot be started!"));

View File

@ -14,12 +14,17 @@ public class StopCommand extends CommandBase<ArcadeManager>
{
public StopCommand(ArcadeManager plugin)
{
super(plugin, ArcadeManager.Perm.STOP_GAME_COMMAND, "stop");
super(plugin, GameCommand.Perm.GAME_COMMAND_DUMMY_PERM, "stop");
}
@Override
public void Execute(Player caller, String[] args)
{
if (!Plugin.canPlayerUseGameCmd(caller))
{
return;
}
if (Plugin.GetGame() == null)
{
UtilPlayer.message(caller, F.main("Game", "There is no game to stop!"));

View File

@ -5,7 +5,6 @@ import org.bukkit.entity.Player;
import mineplex.core.Managers;
import mineplex.core.account.permissions.Permission;
import mineplex.core.command.CommandBase;
import nautilus.game.arcade.ArcadeManager;
public class DebugCommand extends CommandBase<ArcadeManager>

View File

@ -537,9 +537,13 @@ public abstract class Game extends ListenerComponent implements Lifetimed
}
}
public <T extends Enum<T> & Permission> void registerDebugCommand(String commandName, T permission, DebugCommandExecutor executor)
public <T extends Enum<T> & Permission> void registerDebugCommand(String commandName, T permission, PermissionGroup defaultRank, DebugCommandExecutor executor)
{
DebugCommand command = new DebugCommand(commandName, permission, executor);
if (defaultRank != null)
{
defaultRank.setPermission(permission, true, true);
}
if (UtilServer.isTestServer())
{
PermissionGroup.QA.setPermission(permission, true, true);
@ -2418,6 +2422,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
cleanupModules();
cleanupCommands();
Managers.get(AntiHack.class).resetIgnoredChecks();
Managers.get(AntiHack.class).setStrict(false);
getLifetime().end();
getStatTrackers().forEach(HandlerList::unregisterAll);
getQuestTrackers().forEach(HandlerList::unregisterAll);

View File

@ -8,6 +8,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.SoloGame;
@ -55,6 +56,8 @@ public class BaconBrawl extends SoloGame
.setGiveCompassToSpecs(true)
.setGiveCompassToAlive(false)
.register(this);
StrictAntiHack = true;
}
@EventHandler

View File

@ -46,6 +46,7 @@ import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
@ -274,13 +275,13 @@ public class Bridge extends TeamGame implements OreObsfucation
}
}
registerDebugCommand("bridge", Perm.DEBUG_BRIDGE_COMMAND, (caller, args) ->
registerDebugCommand("bridge", Perm.DEBUG_BRIDGE_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
caller.sendMessage(F.main("Debug", "Spawning the bridges."));
_bridgeTime = 3000;
});
registerDebugCommand("bridgeinfo", Perm.DEBUG_BRIDGEINFO_COMMAND, (caller, args) ->
registerDebugCommand("bridgeinfo", Perm.DEBUG_BRIDGEINFO_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
if (_animation == null || !(_animation instanceof CustomBridgeAnimation))
{

View File

@ -198,7 +198,6 @@ public class Build extends Game
new ChatStatData("BlocksBroken", "Blocks Broken", true)
);
this.StrictAntiHack = true;
this.Damage = false;
this.HungerSet = 20;
this.HealthSet = 20;

View File

@ -2,11 +2,19 @@ package nautilus.game.arcade.game.games.cards;
import java.util.ArrayList;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
@ -16,13 +24,6 @@ import nautilus.game.arcade.game.games.cards.kits.KitPlayer;
import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.kit.Kit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
public class Cards extends SoloGame
{
private CardFactory _cardFactory;
@ -61,7 +62,6 @@ public class Cards extends SoloGame
"based on the build theme!"
});
this.StrictAntiHack = true;
this.Damage = false;
this.HungerSet = 20;
this.HealthSet = 20;

View File

@ -171,7 +171,6 @@ public class CastleAssault extends TeamGame
"Chests refill every 2 minutes with potions, golden applegates, fishing rods, and other useful PvP items!"
};
this.StrictAntiHack = true;
this.HungerSet = 20;
this.DeathOut = false;
this.DeathSpectateSecs = 5;

View File

@ -144,7 +144,6 @@ public class CastleAssaultTDM extends TeamGame
"Chests refill every 2 minutes with potions, golden applegates, fishing rods, and other useful PvP items!"
};
this.StrictAntiHack = true;
this.HungerSet = 20;
this.DeathOut = false;
this.DeathSpectateSecs = 5;

View File

@ -1,11 +1,19 @@
package nautilus.game.arcade.game.games.champions;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.DeathMessageType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.GameTeam;
@ -26,13 +34,6 @@ import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.SpecialWinStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
public class ChampionsCTF extends CaptureTheFlag
{
public ChampionsCTF(ArcadeManager manager)
@ -65,8 +66,6 @@ public class ChampionsCTF extends CaptureTheFlag
Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6);
this.StrictAntiHack = true;
InventoryOpenChest = true;
EloStart = 1000;

View File

@ -1,11 +1,18 @@
package nautilus.game.arcade.game.games.champions;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.DeathMessageType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.GameTeam;
@ -22,12 +29,6 @@ import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
public class ChampionsDominate extends Domination
{
public ChampionsDominate(ArcadeManager manager)
@ -62,8 +63,6 @@ public class ChampionsDominate extends Domination
Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6);
this.StrictAntiHack = true;
InventoryOpenChest = true;
EloStart = 1000;

View File

@ -1,11 +1,18 @@
package nautilus.game.arcade.game.games.champions;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.DeathMessageType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.GameTeam;
@ -23,12 +30,6 @@ import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
public class ChampionsTDM extends TeamDeathmatch
{
public ChampionsTDM(ArcadeManager manager)
@ -62,8 +63,6 @@ public class ChampionsTDM extends TeamDeathmatch
Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6);
this.StrictAntiHack = true;
InventoryOpenChest = true;
this.DisableKillCommand = false;

View File

@ -73,8 +73,6 @@ public class SmashDom extends Domination
Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6);
Manager.getClassManager().deregisterSelf();
StrictAntiHack = true;
InventoryOpenChest = true;
EnableSupply = false;

View File

@ -153,6 +153,8 @@ public class DragonEscape extends SoloGame
.setGiveCompassToSpecs(true)
.setGiveCompassToAlive(false)
.register(this);
StrictAntiHack = true;
}
@Override

View File

@ -108,7 +108,7 @@ public class EventModule extends MiniPlugin
PermissionGroup.ADMIN.setPermission(Perm.SET_HOST_COMMAND, true, true);
if (_plugin.getConfig().getString("serverstatus.name").equals("SMTestServer-1"))
{
PermissionGroup.QA.setPermission(Perm.SET_HOST_COMMAND, true, true);
PermissionGroup.SRMOD.setPermission(Perm.SET_HOST_COMMAND, true, true);
}
}

View File

@ -1,38 +1,12 @@
package nautilus.game.arcade.game.games.evolution;
import com.google.common.collect.Maps;
import mineplex.core.common.Pair;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.CombatManager.AttackReason;
import mineplex.minecraft.game.core.combat.DeathMessageType;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.condition.ConditionActive;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.evolution.events.*;
import nautilus.game.arcade.game.games.evolution.evolve.EvolveManager;
import nautilus.game.arcade.game.games.evolution.kits.KitAbility;
import nautilus.game.arcade.game.games.evolution.kits.KitEvolveSpeed;
import nautilus.game.arcade.game.games.evolution.kits.KitHealth;
import nautilus.game.arcade.game.games.evolution.mobs.*;
import nautilus.game.arcade.game.games.evolution.trackers.*;
import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.stats.KillFastStatTracker;
import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -49,8 +23,61 @@ import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.util.Vector;
import java.util.AbstractMap.SimpleEntry;
import java.util.*;
import mineplex.core.common.Pair;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
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.UtilTextMiddle;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.CombatManager.AttackReason;
import mineplex.minecraft.game.core.combat.DeathMessageType;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.condition.ConditionActive;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent;
import nautilus.game.arcade.game.games.evolution.events.EvolutionAttemptingTickEvent;
import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent;
import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent;
import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent;
import nautilus.game.arcade.game.games.evolution.evolve.EvolveManager;
import nautilus.game.arcade.game.games.evolution.kits.KitAbility;
import nautilus.game.arcade.game.games.evolution.kits.KitEvolveSpeed;
import nautilus.game.arcade.game.games.evolution.kits.KitHealth;
import nautilus.game.arcade.game.games.evolution.mobs.KitBlaze;
import nautilus.game.arcade.game.games.evolution.mobs.KitChicken;
import nautilus.game.arcade.game.games.evolution.mobs.KitCreeper;
import nautilus.game.arcade.game.games.evolution.mobs.KitGolem;
import nautilus.game.arcade.game.games.evolution.mobs.KitSlime;
import nautilus.game.arcade.game.games.evolution.mobs.KitSpider;
import nautilus.game.arcade.game.games.evolution.trackers.EvoWinWithoutDyingTracker;
import nautilus.game.arcade.game.games.evolution.trackers.KillsWhileEvolvingTracker;
import nautilus.game.arcade.game.games.evolution.trackers.NoAbilityTracker;
import nautilus.game.arcade.game.games.evolution.trackers.NoDamageWhileEvolvingTracker;
import nautilus.game.arcade.game.games.evolution.trackers.NoMeleeTracker;
import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KillFastStatTracker;
public class Evolution extends SoloGame
{
@ -152,6 +179,8 @@ public class Evolution extends SoloGame
DamageDealt,
DamageTaken
);
StrictAntiHack = true;
}
public EvolveManager getEvolve()

View File

@ -46,8 +46,6 @@ public class ChampionsGladiators extends Gladiators
Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6);
StrictAntiHack = true;
new ChampionsFixes(this);
manager.enableChampionsModules();

View File

@ -1,64 +1,17 @@
package nautilus.game.arcade.game.games.hideseek;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
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.UtilTime;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketInfo;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.visibility.VisibilityManager;
import mineplex.minecraft.game.core.combat.DeathMessageType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.hideseek.forms.BlockForm;
import nautilus.game.arcade.game.games.hideseek.forms.CreatureForm;
import nautilus.game.arcade.game.games.hideseek.forms.Form;
import nautilus.game.arcade.game.games.hideseek.forms.InfestedData;
import nautilus.game.arcade.game.games.hideseek.kits.KitHider;
import nautilus.game.arcade.game.games.hideseek.kits.KitHiderInfestor;
import nautilus.game.arcade.game.games.hideseek.kits.KitHiderQuick;
import nautilus.game.arcade.game.games.hideseek.kits.KitHiderShocker;
import nautilus.game.arcade.game.games.hideseek.kits.KitHiderSwapper;
import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerLeaper;
import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerRadar;
import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerTNT;
import nautilus.game.arcade.game.games.hideseek.quests.DisguiseQuestTracker;
import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.stats.BadHiderStatTracker;
import nautilus.game.arcade.stats.HunterKillerStatTracker;
import nautilus.game.arcade.stats.HunterOfTheYearStatTracker;
import nautilus.game.arcade.stats.MeowStatTracker;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import net.minecraft.server.v1_8_R3.EntityCreature;
import net.minecraft.server.v1_8_R3.NavigationAbstract;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
@ -105,11 +58,61 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
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.UtilTime;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketInfo;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.visibility.VisibilityManager;
import mineplex.minecraft.game.core.combat.DeathMessageType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.hideseek.forms.BlockForm;
import nautilus.game.arcade.game.games.hideseek.forms.CreatureForm;
import nautilus.game.arcade.game.games.hideseek.forms.Form;
import nautilus.game.arcade.game.games.hideseek.forms.InfestedData;
import nautilus.game.arcade.game.games.hideseek.kits.KitHider;
import nautilus.game.arcade.game.games.hideseek.kits.KitHiderInfestor;
import nautilus.game.arcade.game.games.hideseek.kits.KitHiderQuick;
import nautilus.game.arcade.game.games.hideseek.kits.KitHiderShocker;
import nautilus.game.arcade.game.games.hideseek.kits.KitHiderSwapper;
import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerLeaper;
import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerRadar;
import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerTNT;
import nautilus.game.arcade.game.games.hideseek.quests.DisguiseQuestTracker;
import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.stats.BadHiderStatTracker;
import nautilus.game.arcade.stats.HunterKillerStatTracker;
import nautilus.game.arcade.stats.HunterOfTheYearStatTracker;
import nautilus.game.arcade.stats.MeowStatTracker;
@SuppressWarnings("deprecation")
public class HideSeek extends TeamGame
@ -361,6 +364,8 @@ public class HideSeek extends TeamGame
.setGiveCompassToSpecs(true)
.setGiveCompassToAlive(false)
.register(this);
StrictAntiHack = true;
}
@EventHandler

View File

@ -41,7 +41,6 @@ public class TinyWinners extends Micro
Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6);
StrictAntiHack = true;
getModule(TeamArmorModule.class)
.dontGiveTeamArmor();

View File

@ -124,8 +124,6 @@ public class ChallengeArrowRampage extends Challenge
@Override
public void onStart()
{
Host.StrictAntiHack = false;
ItemStack bow = new ItemBuilder(Material.BOW)
.setUnbreakable(true)
.addEnchantment(Enchantment.ARROW_INFINITE, 1)
@ -141,7 +139,6 @@ public class ChallengeArrowRampage extends Challenge
@Override
public void onEnd()
{
Host.StrictAntiHack = true;
remove(EntityType.FALLING_BLOCK);
}

View File

@ -119,8 +119,6 @@ public class ChallengeBouncingBlock extends Challenge implements LogicTracker
@Override
public void onStart()
{
Host.StrictAntiHack = false;
addEffect(PotionEffectType.JUMP, JUMP_EFFECT_MULTIPLIER);
for (Player player : getPlayersAlive())
@ -132,8 +130,6 @@ public class ChallengeBouncingBlock extends Challenge implements LogicTracker
@Override
public void onEnd()
{
Host.StrictAntiHack = true;
_stepTracker.clear();
for (Block woolBlock : _blocks)

View File

@ -27,6 +27,7 @@ import com.mineplex.anticheat.checks.move.Speed;
import mineplex.core.Managers;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.antihack.AntiHack;
import mineplex.core.common.Pair;
import mineplex.core.common.util.F;
@ -92,6 +93,7 @@ public class Moba extends TeamGame
private static final String[] ITEM_IMAGES =
{
"Ivy.png",
"Anath_the_Burnt.png",
"Bardolf.png",
"Biff.png",
@ -173,7 +175,7 @@ public class Moba extends TeamGame
.setGiveCompassToAlive(false)
.register(this);
registerDebugCommand("kit", Perm.DEBUG_KIT_COMMAND, (caller, args) ->
registerDebugCommand("kit", Perm.DEBUG_KIT_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
StringBuilder builder = new StringBuilder();

View File

@ -0,0 +1,73 @@
package nautilus.game.arcade.game.games.moba.buff.buffs;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.events.EntityVelocityChangeEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
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.UtilTextMiddle;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.buff.Buff;
import nautilus.game.arcade.game.games.moba.kit.HeroSkillUseEvent;
public class BuffCrippled extends Buff<Player>
{
public BuffCrippled(Moba host, Player entity, long duration)
{
super(host, entity, duration);
}
@Override
public void onApply()
{
_entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (_duration / 50D), 1));
UtilTextMiddle.display("", C.cRed + "Crippled", 10, 20, 10, (Player) _entity);
}
@Override
public void onExpire()
{
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
{
return;
}
UtilParticle.PlayParticleToAll(ParticleType.PORTAL, _entity.getLocation().add(0, 1, 0), 0.5F, 0.2F, 0.5F, 0.1F, 5, ViewDist.LONG);
}
@EventHandler
public void velocityApply(EntityVelocityChangeEvent event)
{
if (event.getEntity().equals(_entity))
{
event.setCancelled(true);
}
}
@EventHandler
public void useMovementSkill(HeroSkillUseEvent event)
{
Player player = event.getPlayer();
if (player.equals(_entity) && event.getSkill().isSneakActivate())
{
player.sendMessage(F.main("Game", "You cannot use movement abilities while " + F.name("Crippled") + "."));
event.setCancelled(true);
}
}
}

View File

@ -1,7 +1,13 @@
package nautilus.game.arcade.game.games.moba.buff.buffs;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.events.EntityVelocityChangeEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
@ -9,12 +15,10 @@ import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.buff.Buff;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
import nautilus.game.arcade.game.games.moba.kit.HeroSkillUseEvent;
public class BuffRooting extends Buff<Player>
{
@ -28,6 +32,7 @@ public class BuffRooting extends Buff<Player>
public void onApply()
{
UtilAction.zeroVelocity(_entity);
_entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, Integer.MAX_VALUE, 3));
UtilTextMiddle.display("", C.cRed + "Rooted", 10, 20, 10, (Player) _entity);
}
@ -45,7 +50,7 @@ public class BuffRooting extends Buff<Player>
return;
}
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, _entity.getLocation().add(0, 0.5, 0), 0.5F, 0.2F, 0.5F, 0.1F, 5, ViewDist.LONG);
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, _entity.getLocation().add(0, 1, 0), 0.5F, 0.2F, 0.5F, 0.1F, 3, ViewDist.LONG);
}
@EventHandler
@ -58,21 +63,14 @@ public class BuffRooting extends Buff<Player>
}
@EventHandler
public void move(PlayerMoveEvent event)
public void useMovementSkill(HeroSkillUseEvent event)
{
if (!event.getPlayer().equals(_entity))
Player player = event.getPlayer();
if (player.equals(_entity) && event.getSkill().isSneakActivate())
{
return;
player.sendMessage(F.main("Game", "You cannot use movement abilities while " + F.name("Rooted") + "."));
event.setCancelled(true);
}
Location from = event.getFrom();
Location to = event.getTo();
if (from.getX() == to.getX() && from.getZ() == to.getZ())
{
return;
}
event.setTo(from);
}
}

View File

@ -9,6 +9,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.updater.UpdateType;
@ -44,7 +45,7 @@ public class GoldManager implements Listener
_playerGold = new HashMap<>();
host.registerDebugCommand("gold", Perm.DEBUG_GOLD_COMMAND, (caller, args) ->
host.registerDebugCommand("gold", Perm.DEBUG_GOLD_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
if (args.length < 1)
{

View File

@ -188,12 +188,12 @@ public class HeroSkill extends Perk
if (itemStack.isSimilar(_item))
{
if (_dropItemActivate && !Recharge.Instance.use(player, "Ultimate", _cooldown, false, false))
if (_dropItemActivate && !Recharge.Instance.use(player, "Ultimate", _cooldown - 250, false, false))
{
return false;
}
return true;
return !callEvent(player);
}
return false;
@ -209,13 +209,20 @@ public class HeroSkill extends Perk
Player player = event.getPlayer();
ItemStack itemStack = player.getInventory().getItem(_slot);
if (!hasPerk(player) || UtilPlayer.isSpectator(player) || itemStack == null)
if (!hasPerk(player) || UtilPlayer.isSpectator(player) || itemStack == null || !itemStack.isSimilar(_item))
{
return false;
}
return itemStack.isSimilar(_item);
return !callEvent(player);
}
private boolean callEvent(Player player)
{
HeroSkillUseEvent event = new HeroSkillUseEvent(player, this);
UtilServer.CallEvent(event);
return event.isCancelled();
}
@EventHandler
@ -411,4 +418,9 @@ public class HeroSkill extends Perk
{
return _lastSkill.containsKey(player.getUniqueId());
}
public boolean isSneakActivate()
{
return _sneakActivate;
}
}

View File

@ -0,0 +1,51 @@
package nautilus.game.arcade.game.games.moba.kit;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class HeroSkillUseEvent extends PlayerEvent implements Cancellable
{
private static final HandlerList _handlers = new HandlerList();
private HeroSkill _skill;
private boolean _cancelled;
public HeroSkillUseEvent(Player who, HeroSkill skill)
{
super(who);
_skill = skill;
}
public HeroSkill getSkill()
{
return _skill;
}
@Override
public void setCancelled(boolean cancelled)
{
_cancelled = cancelled;
}
@Override
public boolean isCancelled()
{
return _cancelled;
}
public static HandlerList getHandlerList()
{
return _handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
}

View File

@ -1,10 +1,10 @@
package nautilus.game.arcade.game.games.moba.kit.bardolf;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.kit.bardolf.HeroBardolf.WolfData;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
@ -14,9 +14,14 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.gadget.gadgets.gamemodifiers.moba.skins.HeroSkinGadget;
import mineplex.core.gadget.gadgets.gamemodifiers.moba.skins.HeroSkinGadgetData;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
import nautilus.game.arcade.game.games.moba.kit.bardolf.HeroBardolf.WolfData;
public class SkillFullMoon extends HeroSkill
{
@ -28,6 +33,7 @@ public class SkillFullMoon extends HeroSkill
"As wolves die his power decreases.",
"All Wolves in the pack die after the ultimate ends"
};
private static final String WEREWOLF_KEY = "Bardolf-Werewolf";
private static final ItemStack SKILL_ITEM = new ItemStack(Material.NETHER_STAR);
private static final long DURATION = TimeUnit.SECONDS.toMillis(10);
private static final int HEALTH = 20;
@ -64,9 +70,33 @@ public class SkillFullMoon extends HeroSkill
_active.add(player);
Manager.GetGame().WorldTimeSet = 18000;
player.getWorld().strikeLightningEffect(player.getLocation());
kit.disguise(player, SkinData.BARDOLF_WEREWOLF);
data.setUltimate(true);
List<HeroSkinGadgetData> werewolfDataList = HeroSkinGadget.getSkins().get(WEREWOLF_KEY);
boolean disguised = false;
for (HeroSkinGadgetData normalData : HeroSkinGadget.getSkins().get(kit.GetName()))
{
if (normalData.getGadget().isActive(player))
{
for (HeroSkinGadgetData werewolfData : werewolfDataList)
{
if (normalData.getName().equals(werewolfData.getName()))
{
kit.disguise(player, werewolfData.getSkinData());
disguised = true;
break;
}
}
break;
}
}
if (!disguised)
{
kit.disguise(player, SkinData.BARDOLF_WEREWOLF);
}
float speedIncrease = (float) data.getWolves().size() * SPEED_FACTOR;
data.setLastSpeedIncrease(speedIncrease);

View File

@ -20,6 +20,6 @@ public class HeroIvy extends HeroKit
public HeroIvy(ArcadeManager manager)
{
super(manager, "Ivy", PERKS, MobaRole.WARRIOR, SkinData.SANTA, 20);
super(manager, "Ivy", PERKS, MobaRole.WARRIOR, SkinData.IVY, 20);
}
}

View File

@ -29,7 +29,7 @@ import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.buff.BuffManager;
import nautilus.game.arcade.game.games.moba.buff.buffs.BuffRooting;
import nautilus.game.arcade.game.games.moba.buff.buffs.BuffCrippled;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
public class SkillBoxingRing extends HeroSkill
@ -68,10 +68,6 @@ public class SkillBoxingRing extends HeroSkill
Player player = event.getPlayer();
Location location = player.getLocation().subtract(0, 1, 0);
byte colour = (byte) (Manager.GetGame().GetTeam(player).GetColor() == ChatColor.RED ? 14 : 11);
// // Double Plants work by the bottom block having a data value, in this case 4, the top part of the plant has
// // a data value of 8, this tells the client to render the top of the part of the block located below itself.
// byte bottomFlower = 4;
// byte topFlower = 8;
location.getWorld().playEffect(location, Effect.STEP_SOUND, Material.STAINED_CLAY, colour);
@ -80,10 +76,6 @@ public class SkillBoxingRing extends HeroSkill
Manager.GetBlockRestore().add(block, Material.STAINED_CLAY.getId(), colour, DURATION + UtilMath.rRange(-500, 500));
}
// for (Block block : getSquareBlocks(location, BLOCK_RADIUS, true))
// {
// Manager.GetBlockRestore().add(block, Material.GRASS.getId(), (byte) 0, DURATION + 500 + UtilMath.r(250));
// }
location.add(0, 1, 0);
@ -91,9 +83,6 @@ public class SkillBoxingRing extends HeroSkill
{
Manager.GetBlockRestore().add(block, Material.RED_ROSE.getId(), (byte) 0, DURATION + UtilMath.r(500));
block.getWorld().playEffect(block.getLocation().add(0.5, 0.5, 0.5), Effect.STEP_SOUND, Material.RED_ROSE);
// long duration = DURATION + UtilMath.r(250);
// Manager.GetBlockRestore().add(block, Material.DOUBLE_PLANT.getId(), bottomFlower, duration);
// Manager.GetBlockRestore().add(block, Material.DOUBLE_PLANT.getId(), topFlower, duration);
}
_data.add(new BoxingRingData(player));
@ -134,7 +123,7 @@ public class SkillBoxingRing extends HeroSkill
}
else if (Recharge.Instance.use(nearby, GetName() + " Rooting", 2000, false, false))
{
buffManager.apply(new BuffRooting(host, nearby, DEBUFF_DURATION));
buffManager.apply(new BuffCrippled(host, nearby, DEBUFF_DURATION));
}
else if (Recharge.Instance.use(nearby, GetName() + " Damage", 900, false, false))
{

View File

@ -57,7 +57,8 @@ public class SkillFloralLeap extends HeroSkill
new DustSpellColor(Color.MAGENTA)
};
private static final long DURATION = TimeUnit.SECONDS.toMillis(5);
private static final int BLOCK_RADIUS = 5;
private static final int DAMAGE_RADIUS = 5;
private static final int BLOCK_RADIUS = 3;
private static final PotionEffect DEBUFF = new PotionEffect(PotionEffectType.SLOW, 50, 2, false, false);
private static final int DAMAGE = 2;
@ -143,7 +144,7 @@ public class SkillFloralLeap extends HeroSkill
data.LastDamage = System.currentTimeMillis();
for (LivingEntity nearby : UtilEnt.getInRadius(data.Center, BLOCK_RADIUS).keySet())
for (LivingEntity nearby : UtilEnt.getInRadius(data.Center, DAMAGE_RADIUS).keySet())
{
if (isTeamDamage(player, nearby))
{
@ -201,7 +202,7 @@ public class SkillFloralLeap extends HeroSkill
@EventHandler
public void blockPhysics(BlockPhysicsEvent event)
{
if (event.getChangedType() == Material.LONG_GRASS || event.getChangedType() == Material.RED_ROSE)
if (event.getChangedType() == Material.RED_ROSE)
{
event.setCancelled(true);
}

View File

@ -35,7 +35,7 @@ public class SkillHook extends HeroSkill
"and pulling them towards you."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.VINE);
private static final int RANGE = 7;
private static final int RANGE = 9;
private static final int DAMAGE_PLAYER = 4;
private static final int DAMAGE_MINION = 6;
private static final PotionEffect DEBUFF = new PotionEffect(PotionEffectType.SLOW, 60, 2, false, false);
@ -82,7 +82,7 @@ public class SkillHook extends HeroSkill
return true;
}
for (int i = 0; i < 4; i++)
for (int i = 0; i < 10; i++)
{
if (leash.update())
{
@ -91,7 +91,7 @@ public class SkillHook extends HeroSkill
if (data.Target == null)
{
for (LivingEntity nearby : UtilEnt.getInRadius(leash.getLastLocation().subtract(0, 1.2, 0), 1).keySet())
for (LivingEntity nearby : UtilEnt.getInRadius(leash.getLastLocation().subtract(0, 1.2, 0), 2).keySet())
{
if (isTeamDamage(player, nearby))
{
@ -101,6 +101,7 @@ public class SkillHook extends HeroSkill
if (nearby instanceof Player)
{
data.Target = (Player) nearby;
nearby.addPotionEffect(DEBUFF);
UtilAction.zeroVelocity(nearby);
Manager.GetDamage().NewDamageEvent(nearby, player, null, DamageCause.CUSTOM, DAMAGE_PLAYER, false, false, false, player.getName(), GetName());
}
@ -122,7 +123,6 @@ public class SkillHook extends HeroSkill
if (UtilMath.offset2dSquared(target.getLocation(), player.getLocation()) < 4)
{
UtilAction.zeroVelocity(target);
target.addPotionEffect(DEBUFF);
return true;
}

View File

@ -15,6 +15,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
@ -51,7 +52,7 @@ public class MinionManager implements Listener
_waves = new HashSet<>();
_enabled = true;
host.registerDebugCommand("removeminions", Perm.DEBUG_REMOVEMINIONS_COMMAND, (caller, args) ->
host.registerDebugCommand("removeminions", Perm.DEBUG_REMOVEMINIONS_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
for (MinionWave wave : _waves)
{

View File

@ -122,12 +122,14 @@ public class PrepareSelection implements Listener, IPacketHandler
AtomicInteger i = new AtomicInteger();
GameTeam team = _host.GetTeam(player);
Map<String, Location> spawns = _host.getLocationStartsWith("KIT " + team.GetName().toUpperCase());
Location goBack = spawns.remove("KIT " + team.GetName().toUpperCase() + " GO_BACK");
Location average = UtilAlg.getAverageLocation(team.GetSpawns());
MobaPlayer mobaPlayer = _host.getMobaData(player);
List<HeroKit> heroKits = _host.getKits(mobaPlayer.getRole());
Location goBack = spawns.remove("KIT " + team.GetName().toUpperCase() + " GO_BACK");
UtilServer.runSyncLater(() ->
{
ClientArmorStand goBackStand = ClientArmorStand.spawn(goBack.clone().add(0, 1, 0), player);
goBackStand.setCustomNameVisible(true);
@ -140,8 +142,6 @@ public class PrepareSelection implements Listener, IPacketHandler
_goBackStands.put(player, goBackStand);
UtilServer.runSyncLater(() ->
{
for (Location location : spawns.values())
{
location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, average)));

View File

@ -18,6 +18,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
@ -68,20 +69,20 @@ public class MobaProgression implements Listener
_roleViewers = new HashMap<>();
_roleShop = new MobaRoleShop(host.getArcadeManager());
host.registerDebugCommand("fakeexp", Perm.DEBUG_FAKEEXP_COMMAND, (caller, args) ->
host.registerDebugCommand("fakeexp", Perm.DEBUG_FAKEEXP_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
int exp = Integer.parseInt(args[0]);
_host.GetGems(caller).put("Fake Exp", new GemData(exp, false));
caller.sendMessage(F.main("Debug", "Gave you " + F.elem(exp) + " fake exp."));
});
host.registerDebugCommand("setmobalevel", Perm.DEBUG_SETMOBALEVEL_COMMAND, (caller, args) ->
host.registerDebugCommand("setmobalevel", Perm.DEBUG_SETMOBALEVEL_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
MobaRole role = MobaRole.valueOf(args[0].toUpperCase());
int exp = getExpFor(Integer.parseInt(args[1]) - 1);
_host.getArcadeManager().GetStatsManager().setStat(caller, _host.GetName() + "." + role.getName() + ".ExpEarned", exp);
caller.sendMessage(F.main("Debug", "Set your " + role.getChatColor() + role.getName() + C.cGray + " level to " + F.elem(getLevel(exp) + 1) + "."));
});
host.registerDebugCommand("unlockhero", Perm.DEBUG_UNLOCK_HERO_COMMAND, (caller, args) ->
host.registerDebugCommand("unlockhero", Perm.DEBUG_UNLOCK_HERO_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
Donor donor = _host.getArcadeManager().GetDonation().Get(caller);
String input = args[0];
@ -96,7 +97,7 @@ public class MobaProgression implements Listener
}
}
});
host.registerDebugCommand("lockhero", Perm.DEBUG_LOCK_HERO_COMMAND, (caller, args) ->
host.registerDebugCommand("lockhero", Perm.DEBUG_LOCK_HERO_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
Donor donor = _host.getArcadeManager().GetDonation().Get(caller);
String input = args[0];

View File

@ -9,7 +9,6 @@ import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -20,6 +19,7 @@ import org.bukkit.util.Vector;
import com.mojang.authlib.GameProfile;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
@ -90,11 +90,13 @@ public class MobaUnlockAnimation implements Listener
_player.teleport(_toTeleport);
_npcEntity = _npc.getWorld().spawn(_npc, ArmorStand.class);
GameProfile profile = new GameProfile(UUID.randomUUID(), _kit.GetName());
GameProfile profile = new GameProfile(UUID.randomUUID(), SkinData.getUnusedSkullName());
profile.getProperties().clear();
profile.getProperties().put("textures", _kit.getSkinData().getProperty());
DisguisePlayer disguise = new DisguisePlayer(_npcEntity, profile);
disguise.getHologram()
.setText(_kit.getRole().getChatColor() + C.Bold + _kit.GetName());
_host.getArcadeManager().GetDisguise().disguise(disguise);
}

View File

@ -290,7 +290,7 @@ public class TowerManager implements Listener
{
Location crystalLocation = tower.getCrystal().getLocation();
if (tower.isDead() || tower.getOwner().equals(team) || UtilMath.offsetSquared(crystalLocation, location) > PROJECTILE_RANGE_SQUARED || shouldCancelDamage(tower, shooter))
if (tower.isDead() || tower.getOwner().equals(team) || UtilMath.offsetSquared(crystalLocation, location) > PROJECTILE_RANGE_SQUARED || !canDamage(tower, team) || shouldCancelDamage(tower, shooter))
{
continue;
}
@ -349,7 +349,6 @@ public class TowerManager implements Listener
{
// Is other team
// Is first tower
// Is same lane
// Is dead
if (!team.equals(other.getOwner()) && other.isFirstTower() && other.isDead())
{

View File

@ -25,6 +25,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
@ -194,7 +195,7 @@ public class MobaTraining extends Moba
(int) (Math.ceil(subject.getHealth() / 2D)))
.register(this);
registerDebugCommand("skip", Perm.DEBUG_SKIP_COMMAND, (caller, args) ->
registerDebugCommand("skip", Perm.DEBUG_SKIP_COMMAND, PermissionGroup.PLAYER, (caller, args) ->
{
if (!safeFunction.apply(caller))
{

View File

@ -47,7 +47,6 @@ public class EweHeroes extends SheepGame
Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6);
StrictAntiHack = true;
getModule(TeamArmorModule.class)
.dontGiveTeamArmor();

View File

@ -236,7 +236,6 @@ public abstract class Skyfall extends Game
InventoryOpenChest = true;
DamageFall = false;
SoupEnabled = true;
StrictAntiHack = false;
new CompassModule()
.setGiveCompassToAlive(true)

View File

@ -173,8 +173,6 @@ public abstract class Skywars extends Game
.setGiveCompassToAlive(true)
.register(this);
StrictAntiHack = true;
GameTimeout = 1500000L;
DeathDropItems = true;

View File

@ -33,6 +33,7 @@ import org.bukkit.scheduler.BukkitRunnable;
import com.google.common.collect.Sets;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
@ -147,7 +148,7 @@ public abstract class SuperSmash extends Game
new PerkSpreadsheetModule(this, "SMASH_KITS");
registerDebugCommand("cooldown", Perm.DEBUG_COOLDOWN_COMMAND, (caller, args) ->
registerDebugCommand("cooldown", Perm.DEBUG_COOLDOWN_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
for (Player other : UtilServer.getPlayers())
{
@ -156,16 +157,16 @@ public abstract class SuperSmash extends Game
Announce(C.cWhiteB + caller.getName() + C.cAquaB + " reset cooldowns!");
});
registerDebugCommand("nextsmash", Perm.DEBUG_NEXTSMASH_COMMAND, (caller, args) ->
registerDebugCommand("nextsmash", Perm.DEBUG_NEXTSMASH_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
_nextPowerup = System.currentTimeMillis() + 1000;
Announce(C.cWhiteB + caller.getName() + C.cAquaB + " spawned a smash crystal!");
});
registerDebugCommand("smash", Perm.DEBUG_SMASH_COMMAND, (caller, args) ->
registerDebugCommand("smash", Perm.DEBUG_SMASH_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
giveSmashItem(caller);
});
registerDebugCommand("kit", Perm.DEBUG_KIT_COMMAND, (caller, args) ->
registerDebugCommand("kit", Perm.DEBUG_KIT_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
String kit = "";
@ -187,7 +188,7 @@ public abstract class SuperSmash extends Game
caller.sendMessage(F.main("Kit", "Sorry that is not a kit!"));
});
registerDebugCommand("lives", Perm.DEBUG_LIVES_COMMAND, (caller, args) ->
registerDebugCommand("lives", Perm.DEBUG_LIVES_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
Announce(C.cWhiteB + caller.getName() + C.cAquaB + " reset their lives!");

View File

@ -56,6 +56,7 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
@ -213,7 +214,7 @@ public class SpeedBuilders extends SoloGame
.setGiveCompassToAlive(false)
.register(this);
registerDebugCommand("setnext", Perm.DEBUG_SETNEXT_COMMAND, (caller, args) ->
registerDebugCommand("setnext", Perm.DEBUG_SETNEXT_COMMAND, PermissionGroup.BUILDER, (caller, args) ->
{
if (!UtilServer.isTestServer())
{

View File

@ -29,6 +29,7 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.util.Vector;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
@ -194,12 +195,12 @@ public class TypeWars extends TeamGame
.giveHotbarItem()
.register(this);
registerDebugCommand("money", Perm.DEBUG_MONEY_COMMAND, (caller, args) ->
registerDebugCommand("money", Perm.DEBUG_MONEY_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
_moneyMap.put(caller, 1000);
UtilPlayer.message(caller, F.main("Money", "You got some Money"));
});
registerDebugCommand("boss", Perm.DEBUG_BOSS_COMMAND, (caller, args) ->
registerDebugCommand("boss", Perm.DEBUG_BOSS_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
if (!IsPlaying(caller))
return;

View File

@ -71,6 +71,7 @@ import org.bukkit.scoreboard.Objective;
import org.spigotmc.ActivationRange;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.boosters.event.BoosterItemGiveEvent;
import mineplex.core.common.Pair;
import mineplex.core.common.util.C;
@ -311,7 +312,7 @@ public abstract class UHC extends Game
registerQuestTrackers(new TameQuestTracker(this));
registerDebugCommand("startpvp", Perm.DEBUG_STARTPVP_COMMAND, (caller, args) ->
registerDebugCommand("startpvp", Perm.DEBUG_STARTPVP_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
if (!IsLive())
{
@ -331,7 +332,7 @@ public abstract class UHC extends Game
UtilPlayer.message(caller, F.main("Debug", "Started PvP"));
});
registerDebugCommand("worldinfo", Perm.DEBUG_WORLDINFO_COMMAND, (caller, args) ->
registerDebugCommand("worldinfo", Perm.DEBUG_WORLDINFO_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
if (args == null || args.length == 0)
{
@ -439,16 +440,16 @@ public abstract class UHC extends Game
}
return;
});
registerDebugCommand("uhcgames", Perm.DEBUG_UHCGAMES_COMMAND, (caller, args) ->
registerDebugCommand("uhcgames", Perm.DEBUG_UHCGAMES_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
UtilPlayer.message(caller, F.main("Debug", "As of now, there have been " + _gamesRun + " games played"));
});
registerDebugCommand("uhcgc", Perm.DEBUG_GC_COMMAND, (caller, args) ->
registerDebugCommand("uhcgc", Perm.DEBUG_GC_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
System.gc();
UtilPlayer.message(caller, F.main("Debug", "Cleaned up!"));
});
registerDebugCommand("setcombatlogtimeout", Perm.DEBUG_SETCOMBATLOGTIMEOUT_COMMAND, (caller, args) ->
registerDebugCommand("setcombatlogtimeout", Perm.DEBUG_SETCOMBATLOGTIMEOUT_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
CombatLogModule module = getModule(CombatLogModule.class);
if (module == null)
@ -474,14 +475,14 @@ public abstract class UHC extends Game
UtilPlayer.message(caller, F.main("Debug", "That's not a number!"));
}
});
registerDebugCommand("dm", Perm.DEBUG_DEATHMATCH_COMMAND, (caller, args) ->
registerDebugCommand("dm", Perm.DEBUG_DEATHMATCH_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
SAFE_TIME = 0;
MINING_TIME = 1000;
startPreDeathmatch();
UtilPlayer.message(caller, F.main("Debug", "Starting deathmatch"));
});
registerDebugCommand("uhcentities", Perm.DEBUG_ENTITIES_COMMAND, (caller, args) ->
registerDebugCommand("uhcentities", Perm.DEBUG_ENTITIES_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
for (Entity entity : caller.getNearbyEntities(5.0, 5.0, 5.0))
{
@ -497,7 +498,7 @@ public abstract class UHC extends Game
caller.sendMessage(debug);
}
});
registerDebugCommand("uhcchunk", Perm.DEBUG_CHUNK_COMMAND, (caller, args) ->
registerDebugCommand("uhcchunk", Perm.DEBUG_CHUNK_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
net.minecraft.server.v1_8_R3.Chunk chunk = ((CraftChunk) caller.getLocation().getChunk()).getHandle();
try
@ -539,7 +540,7 @@ public abstract class UHC extends Game
t.printStackTrace();
}
});
registerDebugCommand("uhcallchunks", Perm.DEBUG_CALLCHUNKS_COMMAND, (caller, args) ->
registerDebugCommand("uhcallchunks", Perm.DEBUG_CALLCHUNKS_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
for (net.minecraft.server.v1_8_R3.Chunk chunk : ((CraftWorld) caller.getWorld()).getHandle().chunkProviderServer.chunks.values())
{

View File

@ -14,6 +14,7 @@ import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
@ -39,7 +40,7 @@ public class RejoinModule extends Module
@Override
protected void setup()
{
getGame().registerDebugCommand("rejoin", Perm.DEBUG_REJOIN_COMMAND, (caller, args) ->
getGame().registerDebugCommand("rejoin", Perm.DEBUG_REJOIN_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
if (args.length < 1)
{

View File

@ -7,6 +7,8 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Horse.Color;
import org.bukkit.entity.Horse.Style;
import org.bukkit.entity.Horse.Variant;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -24,13 +26,20 @@ import org.bukkit.inventory.ItemStack;
import mineplex.core.MiniClientPlugin;
import mineplex.core.ReflectivelyCreateMiniPlugin;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseInsentient;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetEnableEvent;
import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.GemHuntersMountGadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.game.GameDisplay;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
@ -38,16 +47,26 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.utils.UtilVariant;
import mineplex.gemhunters.loot.LootItem;
import mineplex.gemhunters.loot.LootModule;
import mineplex.gemhunters.mount.command.MountSkinsCommand;
import mineplex.gemhunters.mount.command.SpawnMountCommand;
@ReflectivelyCreateMiniPlugin
public class MountModule extends MiniClientPlugin<MountData>
{
public enum Perm implements Permission
{
MOUNT_SKINS_COMMAND,
SPAWN_MOUNT_COMMAND
}
private static final ItemStack SADDLE = new ItemStack(Material.SADDLE);
private static final int HEALTH = 40;
private static final int MAX_DIST = 25 * 25;
private static final int MIN_DIST = 4 * 4;
private final CosmeticManager _cosmetic;
private final DisguiseManager _disguise;
private final LootModule _loot;
private final GadgetManager _gadget;
@ -56,9 +75,25 @@ public class MountModule extends MiniClientPlugin<MountData>
{
super("Mount");
_cosmetic = require(CosmeticManager.class);
_disguise = require(DisguiseManager.class);
_loot = require(LootModule.class);
_gadget = require(GadgetManager.class);
generatePermissions();
}
private void generatePermissions()
{
PermissionGroup.PLAYER.setPermission(Perm.MOUNT_SKINS_COMMAND, true, true);
PermissionGroup.ADMIN.setPermission(Perm.SPAWN_MOUNT_COMMAND, true, true);
}
@Override
public void addCommands()
{
addCommand(new MountSkinsCommand(this));
addCommand(new SpawnMountCommand(this));
}
@Override
@ -89,7 +124,7 @@ public class MountModule extends MiniClientPlugin<MountData>
String metadata = lootItem.getMetadata();
String[] split = metadata.split(" ");
if (split.length < 2)
if (split.length < 2 || !split[0].equals("MOUNT"))
{
return;
}
@ -119,6 +154,11 @@ public class MountModule extends MiniClientPlugin<MountData>
return;
}
spawnHorse(player, data, lootItem.getItemStack(), cooldown);
}
public void spawnHorse(Player player, MountData data, ItemStack itemStack, long cooldown)
{
Location location = player.getLocation().add(0, 1, 0);
GemHuntersMountGadget gadget = (GemHuntersMountGadget) _gadget.getGameCosmeticManager().getActiveCosmetic(
player,
@ -131,6 +171,8 @@ public class MountModule extends MiniClientPlugin<MountData>
if (gadget == null)
{
horse = UtilVariant.spawnHorse(location, Variant.HORSE);
horse.setColor(Color.BROWN);
horse.setStyle(Style.NONE);
}
else
{
@ -142,16 +184,24 @@ public class MountModule extends MiniClientPlugin<MountData>
horse.setCustomNameVisible(true);
horse.setJumpStrength(1);
horse.getInventory().setSaddle(SADDLE);
horse.getInventory().setArmor(new ItemStack(lootItem.getItemStack().getType()));
horse.getInventory().setArmor(new ItemStack(itemStack.getType()));
horse.setDomestication(1);
horse.setMaxDomestication(1);
horse.setOwner(player);
horse.setTamed(true);
horse.setCarryingChest(true);
horse.setMaxHealth(HEALTH);
horse.setHealth(HEALTH);
UtilEnt.vegetate(player);
UtilEnt.vegetate(horse);
data.onSpawn(horse, cooldown, lootItem.getItemStack());
DisguiseBase disguise = _disguise.getActiveDisguise(horse);
if (disguise != null && disguise instanceof DisguiseInsentient)
{
((DisguiseInsentient) disguise).setName(name);
}
data.onSpawn(horse, cooldown, itemStack);
player.sendMessage(F.main(_moduleName, "You spawned your " + F.name(getName()) + "."));
}
@ -323,7 +373,31 @@ public class MountModule extends MiniClientPlugin<MountData>
"Mount Skins"
);
if (gadget == null)
{
continue;
}
gadget.getType().onUpdate(event, data.getEntity());
}
}
@EventHandler
public void gadgetEquip(GadgetEnableEvent event)
{
if (event.getGadget().getGadgetType() != GadgetType.GAME_MODIFIER)
{
event.setCancelled(true);
}
}
public CosmeticManager getCosmeticManager()
{
return _cosmetic;
}
public GadgetManager getGadgetManager()
{
return _gadget;
}
}

View File

@ -0,0 +1,25 @@
package mineplex.gemhunters.mount.command;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticCategory;
import mineplex.core.game.GameDisplay;
import mineplex.gemhunters.mount.MountModule;
import mineplex.gemhunters.mount.MountModule.Perm;
public class MountSkinsCommand extends CommandBase<MountModule>
{
public MountSkinsCommand(MountModule plugin)
{
super(plugin, Perm.MOUNT_SKINS_COMMAND, "mount", "mounts", "skins", "mountskins");
}
@Override
public void Execute(Player caller, String[] args)
{
GameCosmeticCategory category = Plugin.getGadgetManager().getGameCosmeticManager().getCategoryFrom(GameDisplay.GemHunters, "Mount Skins");
Plugin.getCosmeticManager().getShop().openPageForPlayer(caller, category.getGadgetPage(Plugin.getCosmeticManager(), caller));
}
}

View File

@ -0,0 +1,32 @@
package mineplex.gemhunters.mount.command;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.command.CommandBase;
import mineplex.gemhunters.mount.MountData;
import mineplex.gemhunters.mount.MountModule;
import mineplex.gemhunters.mount.MountModule.Perm;
public class SpawnMountCommand extends CommandBase<MountModule>
{
public SpawnMountCommand(MountModule plugin)
{
super(plugin, Perm.SPAWN_MOUNT_COMMAND, "spawnmount");
}
@Override
public void Execute(Player caller, String[] args)
{
MountData data = Plugin.Get(caller);
if (data.getEntity() != null)
{
data.getEntity().remove();
}
Plugin.spawnHorse(caller, data, new ItemStack(Material.DIAMOND_BARDING), 0);
}
}

View File

@ -5,6 +5,8 @@ import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import mineplex.googlesheets.util.SkinFetcher;
@ -13,6 +15,8 @@ import mineplex.googlesheets.util.UUIDFetcher;
public class SkinHelperUI extends JFrame
{
private static final Map<String, String> UUID_CACHE = new HashMap<>();
private static final Font FONT = new Font("Verdana", Font.PLAIN, 12);
private static final long FETCH_WAIT_TIME = 30;
private static final long FETCH_WAIT_MILLISECONDS = TimeUnit.SECONDS.toMillis(FETCH_WAIT_TIME);
@ -97,7 +101,16 @@ public class SkinHelperUI extends JFrame
try
{
String[] skinData = SkinFetcher.getSkinData(UUIDFetcher.getPlayerUUIDNoDashes(txtMinecraftName.getText()));
String input = txtMinecraftName.getText();
String uuid = UUID_CACHE.get(input);
if (uuid == null)
{
uuid = UUIDFetcher.getPlayerUUIDNoDashes(input);
UUID_CACHE.put(input, uuid);
}
String[] skinData = SkinFetcher.getSkinData(uuid);
txtSkinValue.setText(skinData[0]);
txtSkinSignature.setText(skinData[1]);

View File

@ -14,28 +14,11 @@ public class SkinFetcher
JSONObject object = UtilJSON.getFromURL(SKIN_URL.replaceFirst("UUID", uuid));
JSONArray properties = (JSONArray) object.get("properties");
System.out.println(properties.size());
for (Object o : properties)
{
System.out.println(o.toString());
}
JSONObject innerObject = (JSONObject) properties.get(0);
System.out.println(innerObject.size());
for (Object o : innerObject.entrySet())
{
System.out.println(o.toString());
}
skinData[1] = (String) innerObject.get("signature");
skinData[0] = (String) innerObject.get("value");
System.out.println(skinData[0]);
System.out.println(skinData[1]);
return skinData;
}