Changes included in this Season of Clans:
- Make the Clans Helmet Packet system more modifiable and versatile (rather than just working on banners) - Modify the Builder's Box to convert everything in the user's inventory to solve the dupe glitch - Make the Builder's Box require accepting a Confirmation dialogue to use - Remove unused Clans command aliases - Remove /c t command - Implement logging of administrative commands performed by the Clans Management team - Patch an exploit where Farming rewards would drop even if the breaking of the block was canceled - Re-implement Clans Maps - Patch a flaw in the Clans promotion system where members could promote recruits (it is now locked to admin+) - Patch a bug in the Clans promotion system where checks for self-promotion would always fail incorrectly - Improve the loot dropped by the Capture Point event to make it more rewarding - Improve the particle effects of the Knight's Steed Clans Mount Skin - Implement the Power Melon and Cake Clans Mount Skins - Patch flaws in the PvP Timer system (instant pickup of mined blocks, block entry to enemy land, block entry to raids and world bosses, allow taking damage from non-player entities) - Patch an issue with Outposts where Runed Pickaxes could instantly mine through them - Change the material of Gold Tokens to RABBIT_FOOT in order to free up the music disc - Implement the new Knight's Greatlance legendary item - Implement secondary ranged attacks to the Scythe of the Fallen Lord - Update all legendary descriptions to be more informative about their usages and to better reflect Clans lore - Patch an exploit with the item cache allowing for legendaries to be used even when they are not actually held - Patch a bug causing CustomItems to be registered as listeners multiple times - Patch a bug where legendaries would not properly track blocking over an extended duration - Patch a bug where several legendaries could impact the entities comprising cannons, causing them to become glitched - Prevent placing several illicit block types (barriers, bedrock, hoppers) - Patch an exploit where logs could be used to spawn infinite trees in order to grief - Allow opening of dispensers, furnaces and droppers during sieges - Prevent placement of dispensers, furnaces and droppers below the minimum chest level
This commit is contained in:
parent
742d849b44
commit
9f37e937fa
@ -44,7 +44,6 @@ import net.minecraft.server.v1_8_R3.WorldServer;
|
|||||||
|
|
||||||
public class UtilSchematic
|
public class UtilSchematic
|
||||||
{
|
{
|
||||||
|
|
||||||
public static Schematic loadSchematic(File file) throws IOException
|
public static Schematic loadSchematic(File file) throws IOException
|
||||||
{
|
{
|
||||||
FileInputStream fis = new FileInputStream(file);
|
FileInputStream fis = new FileInputStream(file);
|
||||||
@ -81,7 +80,7 @@ public class UtilSchematic
|
|||||||
byte[] blockData = getChildTag(schematic, "Data", ByteArrayTag.class).getValue();
|
byte[] blockData = getChildTag(schematic, "Data", ByteArrayTag.class).getValue();
|
||||||
|
|
||||||
Vector weOffset = null;
|
Vector weOffset = null;
|
||||||
if(schematic.containsKey("WEOffsetX") && schematic.containsKey("WEOffsetY") && schematic.containsKey("WEOffsetZ"))
|
if (schematic.containsKey("WEOffsetX") && schematic.containsKey("WEOffsetY") && schematic.containsKey("WEOffsetZ"))
|
||||||
{
|
{
|
||||||
int x = getChildTag(schematic, "WEOffsetX", IntTag.class).getValue();
|
int x = getChildTag(schematic, "WEOffsetX", IntTag.class).getValue();
|
||||||
int y = getChildTag(schematic, "WEOffsetY", IntTag.class).getValue();
|
int y = getChildTag(schematic, "WEOffsetY", IntTag.class).getValue();
|
||||||
@ -100,15 +99,21 @@ public class UtilSchematic
|
|||||||
for (int index = 0; index < blockId.length; index++)
|
for (int index = 0; index < blockId.length; index++)
|
||||||
{
|
{
|
||||||
if ((index >> 1) >= addId.length)
|
if ((index >> 1) >= addId.length)
|
||||||
|
{
|
||||||
blocks[index] = (short) (blockId[index] & 0xFF);
|
blocks[index] = (short) (blockId[index] & 0xFF);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((index & 1) == 0)
|
if ((index & 1) == 0)
|
||||||
|
{
|
||||||
blocks[index] = (short) (((addId[index >> 1] & 0x0F) << 8) + (blockId[index] & 0xFF));
|
blocks[index] = (short) (((addId[index >> 1] & 0x0F) << 8) + (blockId[index] & 0xFF));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
blocks[index] = (short) (((addId[index >> 1] & 0xF0) << 4) + (blockId[index] & 0xFF));
|
blocks[index] = (short) (((addId[index >> 1] & 0xF0) << 4) + (blockId[index] & 0xFF));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Need to pull out tile entities
|
// Need to pull out tile entities
|
||||||
List<Tag> tileEntities = getChildTag(schematic, "TileEntities", ListTag.class).getValue();
|
List<Tag> tileEntities = getChildTag(schematic, "TileEntities", ListTag.class).getValue();
|
||||||
@ -116,7 +121,8 @@ public class UtilSchematic
|
|||||||
|
|
||||||
for (Tag tag : tileEntities)
|
for (Tag tag : tileEntities)
|
||||||
{
|
{
|
||||||
if (!(tag instanceof CompoundTag)) {
|
if (!(tag instanceof CompoundTag))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CompoundTag t = (CompoundTag) tag;
|
CompoundTag t = (CompoundTag) tag;
|
||||||
@ -134,10 +140,12 @@ public class UtilSchematic
|
|||||||
if (entry.getKey().equals("x"))
|
if (entry.getKey().equals("x"))
|
||||||
{
|
{
|
||||||
x = ((IntTag) entry.getValue()).getValue();
|
x = ((IntTag) entry.getValue()).getValue();
|
||||||
} else if (entry.getKey().equals("y"))
|
}
|
||||||
|
else if (entry.getKey().equals("y"))
|
||||||
{
|
{
|
||||||
y = ((IntTag) entry.getValue()).getValue();
|
y = ((IntTag) entry.getValue()).getValue();
|
||||||
} else if (entry.getKey().equals("z"))
|
}
|
||||||
|
else if (entry.getKey().equals("z"))
|
||||||
{
|
{
|
||||||
z = ((IntTag) entry.getValue()).getValue();
|
z = ((IntTag) entry.getValue()).getValue();
|
||||||
}
|
}
|
||||||
@ -152,7 +160,6 @@ public class UtilSchematic
|
|||||||
|
|
||||||
List<Tag> entityTags = getChildTag(schematic, "Entities", ListTag.class).getValue();
|
List<Tag> entityTags = getChildTag(schematic, "Entities", ListTag.class).getValue();
|
||||||
|
|
||||||
|
|
||||||
return new Schematic(width, height, length, blocks, blockData, weOffset, tileEntitiesMap, entityTags);
|
return new Schematic(width, height, length, blocks, blockData, weOffset, tileEntitiesMap, entityTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +190,7 @@ public class UtilSchematic
|
|||||||
map.put("Height", new ShortTag(height));
|
map.put("Height", new ShortTag(height));
|
||||||
map.put("Length", new ShortTag(length));
|
map.put("Length", new ShortTag(length));
|
||||||
|
|
||||||
if(schematic.hasWorldEditOffset())
|
if (schematic.hasWorldEditOffset())
|
||||||
{
|
{
|
||||||
Vector weOffset = schematic.getWorldEditOffset();
|
Vector weOffset = schematic.getWorldEditOffset();
|
||||||
map.put("WEOffsetX", new IntTag(weOffset.getBlockX()));
|
map.put("WEOffsetX", new IntTag(weOffset.getBlockX()));
|
||||||
@ -196,25 +203,25 @@ public class UtilSchematic
|
|||||||
short[] sBlocks = schematic.getBlocks();
|
short[] sBlocks = schematic.getBlocks();
|
||||||
Map<BlockVector, Map<String, Tag>> sTileEntities = schematic.getTileEntities();
|
Map<BlockVector, Map<String, Tag>> sTileEntities = schematic.getTileEntities();
|
||||||
|
|
||||||
|
|
||||||
byte[] blocks = new byte[sBlocks.length];
|
byte[] blocks = new byte[sBlocks.length];
|
||||||
byte[] addBlocks = null;
|
byte[] addBlocks = null;
|
||||||
byte[] blockData = schematic.getBlockData();
|
byte[] blockData = schematic.getBlockData();
|
||||||
List<Tag> tileEntities = new ArrayList<Tag>();
|
List<Tag> tileEntities = new ArrayList<>();
|
||||||
|
|
||||||
for(int x = 0; x < width; x++)
|
for (int x = 0; x < width; x++)
|
||||||
{
|
{
|
||||||
for(int y = 0; y < height; y++)
|
for (int y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
for(int z = 0; z < length; z++)
|
for (int z = 0; z < length; z++)
|
||||||
{
|
{
|
||||||
int index = y * width * length + z * width + x;
|
int index = y * width * length + z * width + x;
|
||||||
BlockVector bv = new BlockVector(x, y, z);
|
BlockVector bv = new BlockVector(x, y, z);
|
||||||
|
|
||||||
//Save 4096 IDs in an AddBlocks section
|
//Save 4096 IDs in an AddBlocks section
|
||||||
if(sBlocks[index] > 255)
|
if (sBlocks[index] > 255)
|
||||||
|
{
|
||||||
|
if (addBlocks == null) // Lazily create section
|
||||||
{
|
{
|
||||||
if (addBlocks == null) { // Lazily create section
|
|
||||||
addBlocks = new byte[(blocks.length >> 1) + 1];
|
addBlocks = new byte[(blocks.length >> 1) + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +232,7 @@ public class UtilSchematic
|
|||||||
|
|
||||||
blocks[index] = (byte) sBlocks[index];
|
blocks[index] = (byte) sBlocks[index];
|
||||||
|
|
||||||
if(sTileEntities.get(bv) != null)
|
if (sTileEntities.get(bv) != null)
|
||||||
{
|
{
|
||||||
Map<String, Tag> values = new HashMap<>(sTileEntities.get(bv));
|
Map<String, Tag> values = new HashMap<>(sTileEntities.get(bv));
|
||||||
values.put("x", new IntTag(x));
|
values.put("x", new IntTag(x));
|
||||||
@ -234,7 +241,6 @@ public class UtilSchematic
|
|||||||
|
|
||||||
CompoundTag tileEntityTag = new CompoundTag(values);
|
CompoundTag tileEntityTag = new CompoundTag(values);
|
||||||
tileEntities.add(tileEntityTag);
|
tileEntities.add(tileEntityTag);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -244,7 +250,8 @@ public class UtilSchematic
|
|||||||
map.put("Data", new ByteArrayTag(blockData));
|
map.put("Data", new ByteArrayTag(blockData));
|
||||||
map.put("TileEntities", new ListTag(CompoundTag.class, tileEntities));
|
map.put("TileEntities", new ListTag(CompoundTag.class, tileEntities));
|
||||||
|
|
||||||
if (addBlocks != null) {
|
if (addBlocks != null)
|
||||||
|
{
|
||||||
map.put("AddBlocks", new ByteArrayTag(addBlocks));
|
map.put("AddBlocks", new ByteArrayTag(addBlocks));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,11 +339,11 @@ public class UtilSchematic
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Tag> entities = new ArrayList<>();
|
List<Tag> entities = new ArrayList<>();
|
||||||
for(Entity e : world.getEntities())
|
for (Entity e : world.getEntities())
|
||||||
{
|
{
|
||||||
if(e instanceof Player) continue;
|
if (e instanceof Player) continue;
|
||||||
|
|
||||||
if(e.getLocation().toVector().isInAABB(min, max))
|
if (e.getLocation().toVector().isInAABB(min, max))
|
||||||
{
|
{
|
||||||
net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity)e).getHandle();
|
net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity)e).getHandle();
|
||||||
|
|
||||||
@ -359,7 +366,6 @@ public class UtilSchematic
|
|||||||
return new Schematic(width, height, length, blocks, blocksData, worldEditOffset, tileEntities, entities);
|
return new Schematic(width, height, length, blocks, blocksData, worldEditOffset, tileEntities, entities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static <T extends Tag> T getChildTag(Map<String, Tag> items, String key, Class<T> expected)
|
private static <T extends Tag> T getChildTag(Map<String, Tag> items, String key, Class<T> expected)
|
||||||
{
|
{
|
||||||
Tag tag = items.get(key);
|
Tag tag = items.get(key);
|
||||||
|
@ -95,6 +95,10 @@ public class UtilEnt
|
|||||||
|
|
||||||
public static boolean hasFlag(Entity entity, String flag)
|
public static boolean hasFlag(Entity entity, String flag)
|
||||||
{
|
{
|
||||||
|
if (entity == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return entity.hasMetadata("flag:" + flag);
|
return entity.hasMetadata("flag:" + flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1058,5 +1062,4 @@ public class UtilEnt
|
|||||||
{
|
{
|
||||||
return ((CraftEntity) entity).getHandle().inWater;
|
return ((CraftEntity) entity).getHandle().inWater;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -156,7 +156,8 @@ public abstract class PunishPage extends ShopPageBase<Punish, PunishShop>
|
|||||||
|
|
||||||
if ((punishment.GetHours() < 0 || punishment.GetRemaining() > 0) && !punishment.GetRemoved() && punishment.GetActive())
|
if ((punishment.GetHours() < 0 || punishment.GetRemaining() > 0) && !punishment.GetRemoved() && punishment.GetActive())
|
||||||
{
|
{
|
||||||
addButton(slot, itemStack, (p, c) -> {
|
addButton(slot, itemStack, (p, c) ->
|
||||||
|
{
|
||||||
if (getPlugin().GetClients().Get(getPlayer()).hasPermission(Punish.Perm.BYPASS_REMOVE_CONFIRMATION))
|
if (getPlugin().GetClients().Get(getPlayer()).hasPermission(Punish.Perm.BYPASS_REMOVE_CONFIRMATION))
|
||||||
{
|
{
|
||||||
removePunishment(punishment);
|
removePunishment(punishment);
|
||||||
|
@ -12,7 +12,7 @@ public class ClansBanCommand extends CommandBase<ClansBanManager>
|
|||||||
{
|
{
|
||||||
public ClansBanCommand(ClansBanManager plugin)
|
public ClansBanCommand(ClansBanManager plugin)
|
||||||
{
|
{
|
||||||
super(plugin, ClansBanManager.Perm.PUNISHMENT_COMMAND, "cbans", "cb", "cban", "cp", "cpunish", "clanspunish", "clanpunish");
|
super(plugin, ClansBanManager.Perm.PUNISHMENT_COMMAND, "cb");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -15,6 +15,9 @@ import mineplex.core.punish.clans.ClansBan;
|
|||||||
import mineplex.core.punish.clans.ClansBanClient;
|
import mineplex.core.punish.clans.ClansBanClient;
|
||||||
import mineplex.core.punish.clans.ClansBanManager;
|
import mineplex.core.punish.clans.ClansBanManager;
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
|
import mineplex.core.slack.SlackAPI;
|
||||||
|
import mineplex.core.slack.SlackMessage;
|
||||||
|
import mineplex.core.slack.SlackTeam;
|
||||||
|
|
||||||
public class ClansBanPage extends ShopPageBase<ClansBanManager, ClansBanShop>
|
public class ClansBanPage extends ShopPageBase<ClansBanManager, ClansBanShop>
|
||||||
{
|
{
|
||||||
@ -129,8 +132,11 @@ public class ClansBanPage extends ShopPageBase<ClansBanManager, ClansBanShop>
|
|||||||
{
|
{
|
||||||
getPlugin().unban(_victimClient, ban, getPlayer().getName(), _reason, () ->
|
getPlugin().unban(_victimClient, ban, getPlayer().getName(), _reason, () ->
|
||||||
{
|
{
|
||||||
refresh();
|
|
||||||
playAcceptSound(player);
|
playAcceptSound(player);
|
||||||
|
SlackAPI.getInstance().sendMessage(SlackTeam.DEVELOPER, "#clans-commandspy",
|
||||||
|
new SlackMessage("Clans Command Logger", "crossed_swords", getPlayer().getName() + " has removed a blacklist from " + _victimName + " for " + _reason + "."),
|
||||||
|
true);
|
||||||
|
refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -149,6 +155,9 @@ public class ClansBanPage extends ShopPageBase<ClansBanManager, ClansBanShop>
|
|||||||
if (ban.isPresent())
|
if (ban.isPresent())
|
||||||
{
|
{
|
||||||
playAcceptSound(getPlayer());
|
playAcceptSound(getPlayer());
|
||||||
|
SlackAPI.getInstance().sendMessage(SlackTeam.DEVELOPER, "#clans-commandspy",
|
||||||
|
new SlackMessage("Clans Command Logger", "crossed_swords", getPlayer().getName() + " has blacklisted " + _victimName + " for " + _reason + ". Duration: " + UtilTime.MakeStr(_time)),
|
||||||
|
true);
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -78,7 +78,9 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
|
|||||||
getPlugin().getScheduler().cancelTask(_taskId);
|
getPlugin().getScheduler().cancelTask(_taskId);
|
||||||
|
|
||||||
if (_returnPage != null)
|
if (_returnPage != null)
|
||||||
|
{
|
||||||
getShop().openPageForPlayer(player, _returnPage);
|
getShop().openPageForPlayer(player, _returnPage);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
@ -150,8 +152,10 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
|
|||||||
Bukkit.getScheduler().cancelTask(_taskId);
|
Bukkit.getScheduler().cancelTask(_taskId);
|
||||||
|
|
||||||
if (_returnPage != null && getShop() != null)
|
if (_returnPage != null && getShop() != null)
|
||||||
|
{
|
||||||
getShop().setCurrentPageForPlayer(getPlayer(), _returnPage);
|
getShop().setCurrentPageForPlayer(getPlayer(), _returnPage);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
|
@ -6,7 +6,6 @@ import mineplex.game.clans.core.ClaimLocation;
|
|||||||
|
|
||||||
public class ClanTerritory
|
public class ClanTerritory
|
||||||
{
|
{
|
||||||
|
|
||||||
public ClanTerritory(ClaimLocation loc, String owner, boolean safe)
|
public ClanTerritory(ClaimLocation loc, String owner, boolean safe)
|
||||||
{
|
{
|
||||||
ClaimLocation = loc;
|
ClaimLocation = loc;
|
||||||
|
@ -77,7 +77,7 @@ import net.minecraft.server.v1_8_R3.MinecraftServer;
|
|||||||
|
|
||||||
public class Clans extends JavaPlugin
|
public class Clans extends JavaPlugin
|
||||||
{
|
{
|
||||||
public static final String MAP = "Season 4";
|
public static final String MAP = "Season 5";
|
||||||
|
|
||||||
public static boolean HARDCORE = false;
|
public static boolean HARDCORE = false;
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package mineplex.game.clans;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
@ -17,7 +18,7 @@ public class Farming extends MiniPlugin
|
|||||||
super("Farming", plugin);
|
super("Farming", plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (ignoreCancelled = true)
|
@EventHandler (priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void BlockBreak(BlockBreakEvent event)
|
public void BlockBreak(BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
if (event.getBlock().getType() != Material.LEAVES)
|
if (event.getBlock().getType() != Material.LEAVES)
|
||||||
|
@ -16,6 +16,9 @@ import mineplex.core.common.util.UtilPlayer;
|
|||||||
import mineplex.core.common.util.UtilPlayerBase;
|
import mineplex.core.common.util.UtilPlayerBase;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilWorld;
|
import mineplex.core.common.util.UtilWorld;
|
||||||
|
import mineplex.core.slack.SlackAPI;
|
||||||
|
import mineplex.core.slack.SlackMessage;
|
||||||
|
import mineplex.core.slack.SlackTeam;
|
||||||
import mineplex.game.clans.core.ClaimLocation;
|
import mineplex.game.clans.core.ClaimLocation;
|
||||||
import mineplex.game.clans.core.repository.ClanTerritory;
|
import mineplex.game.clans.core.repository.ClanTerritory;
|
||||||
import mineplex.game.clans.core.repository.tokens.ClanToken;
|
import mineplex.game.clans.core.repository.tokens.ClanToken;
|
||||||
@ -51,6 +54,22 @@ public class ClansAdmin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StringBuilder cmd = new StringBuilder("/c");
|
||||||
|
for (String a : args)
|
||||||
|
{
|
||||||
|
cmd.append(" ").append(a);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < cmd.length(); i++)
|
||||||
|
{
|
||||||
|
if (cmd.charAt(i) == '`')
|
||||||
|
{
|
||||||
|
cmd.setCharAt(i, '\'');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SlackAPI.getInstance().sendMessage(SlackTeam.DEVELOPER, "#clans-commandspy",
|
||||||
|
new SlackMessage("Clans Command Logger", "crossed_swords", caller.getName() + " has issued command `" + cmd.toString() + "` on " + UtilServer.getServerName() + "."),
|
||||||
|
true);
|
||||||
|
|
||||||
if (args.length == 1)
|
if (args.length == 1)
|
||||||
help(caller);
|
help(caller);
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ public class ClansGame extends MiniPlugin
|
|||||||
{
|
{
|
||||||
if (_clans.getWarManager().isBeingBesiegedBy(_clans.getClanUtility().getOwner(event.getBlock().getLocation()), _clans.getClan(event.getPlayer())))
|
if (_clans.getWarManager().isBeingBesiegedBy(_clans.getClanUtility().getOwner(event.getBlock().getLocation()), _clans.getClan(event.getPlayer())))
|
||||||
{
|
{
|
||||||
if (event.getBlock().getType() == Material.CHEST)
|
if (event.getBlock().getType() == Material.CHEST || event.getBlock().getType() == Material.DISPENSER || event.getBlock().getType() == Material.DROPPER || event.getBlock().getType() == Material.FURNACE || event.getBlock().getType() == Material.BURNING_FURNACE)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -404,7 +404,7 @@ public class ClansGame extends MiniPlugin
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void respawn(PlayerRespawnEvent event)
|
public void respawn(PlayerRespawnEvent event)
|
||||||
{
|
{
|
||||||
//_clans.getItemMapManager().setMap(event.getPlayer());
|
_clans.getItemMapManager().setMap(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
@ -449,7 +449,7 @@ public class ClansGame extends MiniPlugin
|
|||||||
{
|
{
|
||||||
if (_clans.getWarManager().isBeingBesiegedBy(_clans.getClanUtility().getOwner(loc), _clans.getClan(player)))
|
if (_clans.getWarManager().isBeingBesiegedBy(_clans.getClanUtility().getOwner(loc), _clans.getClan(player)))
|
||||||
{
|
{
|
||||||
if (loc.getBlock().getType() == Material.CHEST)
|
if (loc.getBlock().getType() == Material.CHEST || loc.getBlock().getType() == Material.DISPENSER || loc.getBlock().getType() == Material.DROPPER || loc.getBlock().getType() == Material.FURNACE || loc.getBlock().getType() == Material.BURNING_FURNACE)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -103,6 +103,7 @@ import mineplex.game.clans.clans.commands.ClansAllyChatCommand;
|
|||||||
import mineplex.game.clans.clans.commands.ClansChatCommand;
|
import mineplex.game.clans.clans.commands.ClansChatCommand;
|
||||||
import mineplex.game.clans.clans.commands.ClansCommand;
|
import mineplex.game.clans.clans.commands.ClansCommand;
|
||||||
import mineplex.game.clans.clans.commands.KillCommand;
|
import mineplex.game.clans.clans.commands.KillCommand;
|
||||||
|
import mineplex.game.clans.clans.commands.MapCommand;
|
||||||
import mineplex.game.clans.clans.commands.RegionsCommand;
|
import mineplex.game.clans.clans.commands.RegionsCommand;
|
||||||
import mineplex.game.clans.clans.commands.SpeedCommand;
|
import mineplex.game.clans.clans.commands.SpeedCommand;
|
||||||
import mineplex.game.clans.clans.data.PlayerClan;
|
import mineplex.game.clans.clans.data.PlayerClan;
|
||||||
@ -110,6 +111,7 @@ import mineplex.game.clans.clans.event.ClansPlayerDeathEvent;
|
|||||||
import mineplex.game.clans.clans.gui.ClanShop;
|
import mineplex.game.clans.clans.gui.ClanShop;
|
||||||
import mineplex.game.clans.clans.invsee.InvseeManager;
|
import mineplex.game.clans.clans.invsee.InvseeManager;
|
||||||
import mineplex.game.clans.clans.loot.LootManager;
|
import mineplex.game.clans.clans.loot.LootManager;
|
||||||
|
import mineplex.game.clans.clans.map.ItemMapManager;
|
||||||
import mineplex.game.clans.clans.moderation.antialt.AltManager;
|
import mineplex.game.clans.clans.moderation.antialt.AltManager;
|
||||||
import mineplex.game.clans.clans.mounts.MountManager;
|
import mineplex.game.clans.clans.mounts.MountManager;
|
||||||
import mineplex.game.clans.clans.nameblacklist.ClansBlacklist;
|
import mineplex.game.clans.clans.nameblacklist.ClansBlacklist;
|
||||||
@ -242,7 +244,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
private ProjectileManager _projectileManager;
|
private ProjectileManager _projectileManager;
|
||||||
private WorldEventManager _worldEvent;
|
private WorldEventManager _worldEvent;
|
||||||
private Chat _chat;
|
private Chat _chat;
|
||||||
// private ItemMapManager _itemMapManager;
|
private ItemMapManager _itemMapManager;
|
||||||
private DisguiseManager _disguiseManager;
|
private DisguiseManager _disguiseManager;
|
||||||
private NpcManager _npcManager;
|
private NpcManager _npcManager;
|
||||||
private Explosion _explosion;
|
private Explosion _explosion;
|
||||||
@ -328,7 +330,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
_clanGame = new ClansGame(plugin, this);
|
_clanGame = new ClansGame(plugin, this);
|
||||||
_clanUtility = new ClansUtility(this);
|
_clanUtility = new ClansUtility(this);
|
||||||
_tutorial = new TutorialManager(plugin, clientManager, donationManager, chat, hologramManager, this, _npcManager, _taskManager);
|
_tutorial = new TutorialManager(plugin, clientManager, donationManager, chat, hologramManager, this, _npcManager, _taskManager);
|
||||||
// _itemMapManager = new ItemMapManager(this, _tutorial, _worldEvent);
|
_itemMapManager = new ItemMapManager(this, _tutorial, _worldEvent);
|
||||||
new TntGeneratorManager(plugin, this);
|
new TntGeneratorManager(plugin, this);
|
||||||
new SupplyDropManager(plugin);
|
new SupplyDropManager(plugin);
|
||||||
|
|
||||||
@ -442,6 +444,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
_scoreboard = new ClansScoreboardManager(plugin, this, _warManager, _worldEvent, _tutorial, clientManager, donationManager);
|
_scoreboard = new ClansScoreboardManager(plugin, this, _warManager, _worldEvent, _tutorial, clientManager, donationManager);
|
||||||
_clanDataAccess = new ClansDataAccessLayer(this, _scoreboard);
|
_clanDataAccess = new ClansDataAccessLayer(this, _scoreboard);
|
||||||
|
|
||||||
|
new HelmetPacketManager();
|
||||||
_bannerManager = new BannerManager(plugin);
|
_bannerManager = new BannerManager(plugin);
|
||||||
|
|
||||||
_goldManager = new GoldManager(this, _clientManager, donationManager, _clanDataAccess);
|
_goldManager = new GoldManager(this, _clientManager, donationManager, _clanDataAccess);
|
||||||
@ -566,7 +569,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
addCommand(new RegionsCommand(this));
|
addCommand(new RegionsCommand(this));
|
||||||
addCommand(new ClansChatCommand(this));
|
addCommand(new ClansChatCommand(this));
|
||||||
addCommand(new ClansAllyChatCommand(this));
|
addCommand(new ClansAllyChatCommand(this));
|
||||||
// addCommand(new MapCommand(this));
|
addCommand(new MapCommand(this));
|
||||||
addCommand(new SpeedCommand(this));
|
addCommand(new SpeedCommand(this));
|
||||||
addCommand(new KillCommand(this));
|
addCommand(new KillCommand(this));
|
||||||
}
|
}
|
||||||
@ -635,10 +638,10 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
return _inventoryManager;
|
return _inventoryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public ItemMapManager getItemMapManager()
|
public ItemMapManager getItemMapManager()
|
||||||
// {
|
{
|
||||||
// return _itemMapManager;
|
return _itemMapManager;
|
||||||
// }
|
}
|
||||||
|
|
||||||
public Explosion getExplosion()
|
public Explosion getExplosion()
|
||||||
{
|
{
|
||||||
|
@ -977,11 +977,18 @@ public class ClansUtility
|
|||||||
}
|
}
|
||||||
|
|
||||||
ClansPlayer self = clan.getMembers().get(caller.getUniqueId());
|
ClansPlayer self = clan.getMembers().get(caller.getUniqueId());
|
||||||
|
|
||||||
|
if (self.getRole().ordinal() < ClanRole.ADMIN.ordinal())
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("Clans", "Only Clan Admins and Leaders can promote others."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ClansPlayer target = clan.getClansPlayerFromName(other);
|
ClansPlayer target = clan.getClansPlayerFromName(other);
|
||||||
|
|
||||||
if (target == null) return;
|
if (target == null) return;
|
||||||
|
|
||||||
if (target.equals(caller.getName()))
|
if (target.getPlayerName().equals(caller.getName()))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main("Clans", "You cannot promote yourself."));
|
UtilPlayer.message(caller, F.main("Clans", "You cannot promote yourself."));
|
||||||
return;
|
return;
|
||||||
@ -1029,11 +1036,18 @@ public class ClansUtility
|
|||||||
}
|
}
|
||||||
|
|
||||||
ClansPlayer self = clan.getMembers().get(caller.getUniqueId());
|
ClansPlayer self = clan.getMembers().get(caller.getUniqueId());
|
||||||
|
|
||||||
|
if (self.getRole().ordinal() < ClanRole.ADMIN.ordinal())
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("Clans", "Only Clan Admins and Leaders can demote others."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ClansPlayer target = clan.getClansPlayerFromName(other);
|
ClansPlayer target = clan.getClansPlayerFromName(other);
|
||||||
|
|
||||||
if (target == null) return;
|
if (target == null) return;
|
||||||
|
|
||||||
if (target.equals(caller.getName()))
|
if (target.getPlayerName().equals(caller.getName()))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main("Clans", "You cannot demote yourself."));
|
UtilPlayer.message(caller, F.main("Clans", "You cannot demote yourself."));
|
||||||
return;
|
return;
|
||||||
|
@ -0,0 +1,124 @@
|
|||||||
|
package mineplex.game.clans.clans;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.packethandler.IPacketHandler;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSetSlot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler for custom helmet display packets
|
||||||
|
*/
|
||||||
|
public class HelmetPacketManager implements Listener
|
||||||
|
{
|
||||||
|
private static final net.minecraft.server.v1_8_R3.ItemStack MELON = CraftItemStack.asNMSCopy(new ItemStack(Material.MELON_BLOCK));
|
||||||
|
private Field _itemField;
|
||||||
|
private static HelmetPacketManager Instance;
|
||||||
|
private final Map<Player, IPacketHandler> _handlers = new HashMap<>();
|
||||||
|
|
||||||
|
public HelmetPacketManager()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_itemField = PacketPlayOutSetSlot.class.getDeclaredField("c");
|
||||||
|
_itemField.setAccessible(true);
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().registerEvents(this, ClansManager.getInstance().getPlugin());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches the registered loaded instance of this class
|
||||||
|
* @return The loaded instance of this class
|
||||||
|
*/
|
||||||
|
public static HelmetPacketManager getInstance()
|
||||||
|
{
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a player helmet update to all other players
|
||||||
|
* @param player The player to update for
|
||||||
|
* @param banner The helmet to display, or null to show the player's actual helmet
|
||||||
|
*/
|
||||||
|
public void refreshToAll(Player player, ItemStack item)
|
||||||
|
{
|
||||||
|
ItemStack show = item;
|
||||||
|
|
||||||
|
if (show == null)
|
||||||
|
{
|
||||||
|
show = new ItemStack(Material.AIR);
|
||||||
|
if (player.getInventory().getHelmet() != null)
|
||||||
|
{
|
||||||
|
show = player.getInventory().getHelmet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Player refresh : Bukkit.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
UtilPlayer.sendPacket(refresh, new PacketPlayOutEntityEquipment(player.getEntityId(), 4, CraftItemStack.asNMSCopy(item)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onJoin(PlayerJoinEvent event)
|
||||||
|
{
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
IPacketHandler helmetHandler = (packetInfo) ->
|
||||||
|
{
|
||||||
|
if (packetInfo.getPacket() instanceof PacketPlayOutEntityEquipment)
|
||||||
|
{
|
||||||
|
PacketPlayOutEntityEquipment equip = (PacketPlayOutEntityEquipment) packetInfo.getPacket();
|
||||||
|
|
||||||
|
if (equip.a == player.getEntityId() && equip.b == 4)
|
||||||
|
{
|
||||||
|
ItemStack banner = UtilEnt.GetMetadata(player, "HelmetPacket.Banner");
|
||||||
|
boolean melon = UtilEnt.hasFlag(player.getVehicle(), "HelmetPacket.RiderMelon");
|
||||||
|
|
||||||
|
if (banner != null)
|
||||||
|
{
|
||||||
|
equip.c = CraftItemStack.asNMSCopy(banner);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (melon)
|
||||||
|
{
|
||||||
|
equip.c = MELON;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
_handlers.put(event.getPlayer(), helmetHandler);
|
||||||
|
ClansManager.getInstance().getPacketHandler().addPacketHandler(helmetHandler, PacketPlayOutEntityEquipment.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onQuit(PlayerQuitEvent event)
|
||||||
|
{
|
||||||
|
if (_handlers.containsKey(event.getPlayer()))
|
||||||
|
{
|
||||||
|
ClansManager.getInstance().getPacketHandler().removePacketHandler(_handlers.remove(event.getPlayer()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,8 +3,6 @@ package mineplex.game.clans.clans.banners;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Banner;
|
import org.bukkit.block.Banner;
|
||||||
@ -36,6 +34,7 @@ import mineplex.game.clans.clans.ClanInfo;
|
|||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.clans.banners.command.BannerCommand;
|
import mineplex.game.clans.clans.banners.command.BannerCommand;
|
||||||
import mineplex.game.clans.core.repository.ClanTerritory;
|
import mineplex.game.clans.core.repository.ClanTerritory;
|
||||||
|
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manager class for cosmetic clans banners
|
* Manager class for cosmetic clans banners
|
||||||
@ -57,7 +56,6 @@ public class BannerManager extends MiniPlugin
|
|||||||
super("Clan Banners", plugin);
|
super("Clan Banners", plugin);
|
||||||
_repo = new BannerRepository(plugin, this);
|
_repo = new BannerRepository(plugin, this);
|
||||||
|
|
||||||
new BannerPacketManager();
|
|
||||||
addCommand(new BannerCommand(this));
|
addCommand(new BannerCommand(this));
|
||||||
|
|
||||||
generatePermissions();
|
generatePermissions();
|
||||||
|
@ -1,113 +0,0 @@
|
|||||||
package mineplex.game.clans.clans.banners;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.packethandler.IPacketHandler;
|
|
||||||
import mineplex.core.packethandler.PacketInfo;
|
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment;
|
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSetSlot;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handler for banner wearing packets
|
|
||||||
*/
|
|
||||||
public class BannerPacketManager implements Listener
|
|
||||||
{
|
|
||||||
private Field _itemField;
|
|
||||||
private static BannerPacketManager Instance;
|
|
||||||
private final HashMap<Player, IPacketHandler> _wearing = new HashMap<>();
|
|
||||||
|
|
||||||
public BannerPacketManager()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_itemField = PacketPlayOutSetSlot.class.getDeclaredField("c");
|
|
||||||
_itemField.setAccessible(true);
|
|
||||||
|
|
||||||
Bukkit.getPluginManager().registerEvents(this, ClansManager.getInstance().getPlugin());
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
Instance = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetches the registered loaded instance of this class
|
|
||||||
* @return The loaded instance of this class
|
|
||||||
*/
|
|
||||||
public static BannerPacketManager getInstance()
|
|
||||||
{
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Toggles a player wearing their clan's banner
|
|
||||||
* @param player The player to toggle for
|
|
||||||
* @param banner The banner to toggle
|
|
||||||
*/
|
|
||||||
public void toggleBanner(Player player, ItemStack banner)
|
|
||||||
{
|
|
||||||
if (_wearing.containsKey(player))
|
|
||||||
{
|
|
||||||
IPacketHandler bannerHandler = _wearing.remove(player);
|
|
||||||
ClansManager.getInstance().getPacketHandler().removePacketHandler(bannerHandler);
|
|
||||||
for (Player refresh : Bukkit.getOnlinePlayers())
|
|
||||||
{
|
|
||||||
ItemStack helmet = new ItemStack(Material.AIR);
|
|
||||||
if (player.getInventory().getHelmet() != null)
|
|
||||||
{
|
|
||||||
helmet = player.getInventory().getHelmet();
|
|
||||||
}
|
|
||||||
UtilPlayer.sendPacket(refresh, new PacketPlayOutEntityEquipment(player.getEntityId(), 4, CraftItemStack.asNMSCopy(helmet)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IPacketHandler bannerHandler = new IPacketHandler()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void handle(PacketInfo packetInfo)
|
|
||||||
{
|
|
||||||
if (packetInfo.getPacket() instanceof PacketPlayOutEntityEquipment)
|
|
||||||
{
|
|
||||||
PacketPlayOutEntityEquipment equip = (PacketPlayOutEntityEquipment) packetInfo.getPacket();
|
|
||||||
|
|
||||||
if (equip.a == player.getEntityId() && equip.b == 4)
|
|
||||||
{
|
|
||||||
equip.c = CraftItemStack.asNMSCopy(banner);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
_wearing.put(player, bannerHandler);
|
|
||||||
ClansManager.getInstance().getPacketHandler().addPacketHandler(bannerHandler, PacketPlayOutEntityEquipment.class);
|
|
||||||
for (Player refresh : Bukkit.getOnlinePlayers())
|
|
||||||
{
|
|
||||||
UtilPlayer.sendPacket(refresh, new PacketPlayOutEntityEquipment(player.getEntityId(), 4, CraftItemStack.asNMSCopy(banner)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onQuit(PlayerQuitEvent event)
|
|
||||||
{
|
|
||||||
if (_wearing.containsKey(event.getPlayer()))
|
|
||||||
{
|
|
||||||
ClansManager.getInstance().getPacketHandler().removePacketHandler(_wearing.remove(event.getPlayer()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,11 +4,12 @@ import java.util.Arrays;
|
|||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
import mineplex.game.clans.clans.ClanRole;
|
import mineplex.game.clans.clans.ClanRole;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.clans.banners.BannerPacketManager;
|
import mineplex.game.clans.clans.HelmetPacketManager;
|
||||||
import mineplex.game.clans.clans.banners.ClanBanner;
|
import mineplex.game.clans.clans.banners.ClanBanner;
|
||||||
import mineplex.game.clans.clans.banners.gui.BannerGUI;
|
import mineplex.game.clans.clans.banners.gui.BannerGUI;
|
||||||
import mineplex.game.clans.clans.banners.gui.overview.OverviewGUI;
|
import mineplex.game.clans.clans.banners.gui.overview.OverviewGUI;
|
||||||
@ -59,8 +60,19 @@ public class NonEditOverviewGUI extends BannerGUI
|
|||||||
{
|
{
|
||||||
if (type == ClickType.LEFT)
|
if (type == ClickType.LEFT)
|
||||||
{
|
{
|
||||||
BannerPacketManager.getInstance().toggleBanner(getViewer(), _banner.getBanner());
|
if (UtilEnt.GetMetadata(getViewer(), "HelmetPacket.Banner") != null)
|
||||||
UtilPlayer.message(getViewer(), F.main("Clan Banners", "You have toggled your banner!"));
|
{
|
||||||
|
UtilEnt.removeMetadata(getViewer(), "HelmetPacket.Banner");
|
||||||
|
HelmetPacketManager.getInstance().refreshToAll(getViewer(), null);
|
||||||
|
UtilPlayer.message(getViewer(), F.main("Clan Banners", "You have removed your banner!"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ItemStack banner = _banner.getBanner();
|
||||||
|
UtilEnt.SetMetadata(getViewer(), "HelmetPacket.Banner", banner);
|
||||||
|
HelmetPacketManager.getInstance().refreshToAll(getViewer(), banner);
|
||||||
|
UtilPlayer.message(getViewer(), F.main("Clan Banners", "You have donned your banner!"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (type == ClickType.RIGHT)
|
else if (type == ClickType.RIGHT)
|
||||||
{
|
{
|
||||||
|
@ -19,11 +19,10 @@ import mineplex.core.Managers;
|
|||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
import mineplex.game.clans.clans.boxes.extra.BuilderBoxInventory;
|
import mineplex.game.clans.clans.boxes.extra.BuilderBox;
|
||||||
|
|
||||||
public class BoxManager extends MiniPlugin
|
public class BoxManager extends MiniPlugin
|
||||||
{
|
{
|
||||||
private final BuilderBoxInventory _builderBox;
|
|
||||||
private final BoxShop _shop;
|
private final BoxShop _shop;
|
||||||
|
|
||||||
public BoxManager(JavaPlugin plugin)
|
public BoxManager(JavaPlugin plugin)
|
||||||
@ -31,8 +30,6 @@ public class BoxManager extends MiniPlugin
|
|||||||
super("Box Manager", plugin);
|
super("Box Manager", plugin);
|
||||||
|
|
||||||
_shop = new BoxShop(this);
|
_shop = new BoxShop(this);
|
||||||
|
|
||||||
_builderBox = new BuilderBoxInventory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openDyePage(Player player)
|
public void openDyePage(Player player)
|
||||||
@ -163,7 +160,7 @@ public class BoxManager extends MiniPlugin
|
|||||||
|
|
||||||
public static enum BoxType
|
public static enum BoxType
|
||||||
{
|
{
|
||||||
BUILDER_BOX("Clans Builder Box", C.cGold + "Builder's Box", Material.GLOWSTONE, Managers.get(BoxManager.class)._builderBox::open),
|
BUILDER_BOX("Clans Builder Box", C.cGold + "Builder's Box", Material.GLOWSTONE, BuilderBox::open),
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
DYE_BOX(null, C.cGreen + "Dye Box", Material.INK_SACK, DyeColor.RED.getDyeData(), Managers.get(BoxManager.class)::openDyePage),
|
DYE_BOX(null, C.cGreen + "Dye Box", Material.INK_SACK, DyeColor.RED.getDyeData(), Managers.get(BoxManager.class)::openDyePage),
|
||||||
;
|
;
|
||||||
|
@ -0,0 +1,106 @@
|
|||||||
|
package mineplex.game.clans.clans.boxes.extra;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.bukkit.DyeColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import mineplex.core.common.Pair;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.clans.boxes.BoxManager.BoxType;
|
||||||
|
|
||||||
|
public class BuilderBox
|
||||||
|
{
|
||||||
|
private static final Map<Pair<Material, Byte>, ItemStack> REPLACEMENT_ITEMS;
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
Map<Pair<Material, Byte>, ItemStack> replacements = new HashMap<>();
|
||||||
|
replacements.put(Pair.create(Material.STONE, (byte)0), new ItemStack(Material.STAINED_CLAY));
|
||||||
|
replacements.put(Pair.create(Material.GLASS, (byte)0), new ItemStack(Material.STAINED_GLASS));
|
||||||
|
replacements.put(Pair.create(Material.THIN_GLASS, (byte)0), new ItemStack(Material.STAINED_GLASS_PANE));
|
||||||
|
replacements.put(Pair.create(Material.WOOL, (byte)0), new ItemStack(Material.WOOL));
|
||||||
|
replacements.put(Pair.create(Material.CARPET, (byte)0), new ItemStack(Material.CARPET));
|
||||||
|
replacements.put(Pair.create(Material.RED_ROSE, (byte)0), new ItemStack(Material.RED_ROSE));
|
||||||
|
replacements.put(Pair.create(Material.RED_ROSE, (byte)1), new ItemStack(Material.RED_ROSE));
|
||||||
|
replacements.put(Pair.create(Material.RED_ROSE, (byte)2), new ItemStack(Material.RED_ROSE));
|
||||||
|
replacements.put(Pair.create(Material.RED_ROSE, (byte)3), new ItemStack(Material.RED_ROSE));
|
||||||
|
replacements.put(Pair.create(Material.RED_ROSE, (byte)4), new ItemStack(Material.RED_ROSE));
|
||||||
|
replacements.put(Pair.create(Material.RED_ROSE, (byte)5), new ItemStack(Material.RED_ROSE));
|
||||||
|
replacements.put(Pair.create(Material.RED_ROSE, (byte)6), new ItemStack(Material.RED_ROSE));
|
||||||
|
replacements.put(Pair.create(Material.RED_ROSE, (byte)7), new ItemStack(Material.RED_ROSE));
|
||||||
|
replacements.put(Pair.create(Material.RED_ROSE, (byte)8), new ItemStack(Material.RED_ROSE));
|
||||||
|
replacements.put(Pair.create(Material.COBBLE_WALL, (byte)0), new ItemStack(Material.COBBLE_WALL));
|
||||||
|
replacements.put(Pair.create(Material.JACK_O_LANTERN, (byte)0), new ItemStack(Material.GLOWSTONE));
|
||||||
|
replacements.put(Pair.create(Material.SMOOTH_BRICK, (byte)0), new ItemStack(Material.SMOOTH_BRICK));
|
||||||
|
|
||||||
|
REPLACEMENT_ITEMS = Collections.unmodifiableMap(replacements);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
private static ItemStack convert(ItemStack old)
|
||||||
|
{
|
||||||
|
if (old == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Pair<Material, Byte> pair = Pair.create(old.getType(), old.getData().getData());
|
||||||
|
if (!REPLACEMENT_ITEMS.containsKey(pair))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ItemBuilder after = new ItemBuilder(REPLACEMENT_ITEMS.get(pair));
|
||||||
|
if (after.getType() == Material.RED_ROSE)
|
||||||
|
{
|
||||||
|
after.setData((short)UtilMath.r(9));
|
||||||
|
}
|
||||||
|
else if (after.getType() == Material.COBBLE_WALL)
|
||||||
|
{
|
||||||
|
after.setData((short)1);
|
||||||
|
}
|
||||||
|
else if (after.getType() == Material.GLOWSTONE)
|
||||||
|
{
|
||||||
|
after.setData((short)0);
|
||||||
|
}
|
||||||
|
else if (after.getType() == Material.SMOOTH_BRICK)
|
||||||
|
{
|
||||||
|
after.setData(UtilMath.randomElement(new Short[] {1, 3}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
after.setData(UtilMath.randomElement(DyeColor.values()).getWoolData());
|
||||||
|
}
|
||||||
|
after.setAmount(old.getAmount());
|
||||||
|
|
||||||
|
return after.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void open(Player player)
|
||||||
|
{
|
||||||
|
boolean used = false;
|
||||||
|
for (int i = 0; i < player.getInventory().getSize(); i++)
|
||||||
|
{
|
||||||
|
ItemStack converted = convert(player.getInventory().getItem(i));
|
||||||
|
if (converted == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
used = true;
|
||||||
|
player.getInventory().setItem(i, converted);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (used)
|
||||||
|
{
|
||||||
|
ClansManager.getInstance().getInventoryManager().addItemToInventory(player, BoxType.BUILDER_BOX.getItemName(), -1);
|
||||||
|
UtilPlayer.message(player, F.main("Builder's Box", "You have redeemed your box contents!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,171 +0,0 @@
|
|||||||
package mineplex.game.clans.clans.boxes.extra;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.DyeColor;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
import org.bukkit.inventory.InventoryView;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import mineplex.core.common.Pair;
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
import mineplex.core.common.util.UtilMath;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
|
||||||
import mineplex.game.clans.clans.boxes.BoxManager.BoxType;
|
|
||||||
|
|
||||||
public class BuilderBoxInventory implements Listener
|
|
||||||
{
|
|
||||||
private Map<Pair<Material, Byte>, ItemStack> _replace = new HashMap<>();
|
|
||||||
|
|
||||||
public BuilderBoxInventory()
|
|
||||||
{
|
|
||||||
_replace.put(Pair.create(Material.STONE, (byte)0), new ItemStack(Material.STAINED_CLAY));
|
|
||||||
_replace.put(Pair.create(Material.GLASS, (byte)0), new ItemStack(Material.STAINED_GLASS));
|
|
||||||
_replace.put(Pair.create(Material.THIN_GLASS, (byte)0), new ItemStack(Material.STAINED_GLASS_PANE));
|
|
||||||
_replace.put(Pair.create(Material.WOOL, (byte)0), new ItemStack(Material.WOOL));
|
|
||||||
_replace.put(Pair.create(Material.CARPET, (byte)0), new ItemStack(Material.CARPET));
|
|
||||||
_replace.put(Pair.create(Material.RED_ROSE, (byte)0), new ItemStack(Material.RED_ROSE));
|
|
||||||
_replace.put(Pair.create(Material.RED_ROSE, (byte)1), new ItemStack(Material.RED_ROSE));
|
|
||||||
_replace.put(Pair.create(Material.RED_ROSE, (byte)2), new ItemStack(Material.RED_ROSE));
|
|
||||||
_replace.put(Pair.create(Material.RED_ROSE, (byte)3), new ItemStack(Material.RED_ROSE));
|
|
||||||
_replace.put(Pair.create(Material.RED_ROSE, (byte)4), new ItemStack(Material.RED_ROSE));
|
|
||||||
_replace.put(Pair.create(Material.RED_ROSE, (byte)5), new ItemStack(Material.RED_ROSE));
|
|
||||||
_replace.put(Pair.create(Material.RED_ROSE, (byte)6), new ItemStack(Material.RED_ROSE));
|
|
||||||
_replace.put(Pair.create(Material.RED_ROSE, (byte)7), new ItemStack(Material.RED_ROSE));
|
|
||||||
_replace.put(Pair.create(Material.RED_ROSE, (byte)8), new ItemStack(Material.RED_ROSE));
|
|
||||||
_replace.put(Pair.create(Material.COBBLE_WALL, (byte)0), new ItemStack(Material.COBBLE_WALL));
|
|
||||||
_replace.put(Pair.create(Material.JACK_O_LANTERN, (byte)0), new ItemStack(Material.GLOWSTONE));
|
|
||||||
_replace.put(Pair.create(Material.SMOOTH_BRICK, (byte)0), new ItemStack(Material.SMOOTH_BRICK));
|
|
||||||
|
|
||||||
UtilServer.RegisterEvents(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
private Pair<ItemStack, Boolean> convert(ItemStack old)
|
|
||||||
{
|
|
||||||
if (old == null)
|
|
||||||
{
|
|
||||||
return Pair.create(old, false);
|
|
||||||
}
|
|
||||||
Pair<Material, Byte> pair = Pair.create(old.getType(), old.getData().getData());
|
|
||||||
if (!_replace.containsKey(pair))
|
|
||||||
{
|
|
||||||
return Pair.create(old, false);
|
|
||||||
}
|
|
||||||
ItemBuilder after = new ItemBuilder(_replace.get(pair));
|
|
||||||
if (after.getType() == Material.RED_ROSE)
|
|
||||||
{
|
|
||||||
after.setData((short)UtilMath.r(9));
|
|
||||||
}
|
|
||||||
else if (after.getType() == Material.COBBLE_WALL)
|
|
||||||
{
|
|
||||||
after.setData((short)1);
|
|
||||||
}
|
|
||||||
else if (after.getType() == Material.GLOWSTONE)
|
|
||||||
{
|
|
||||||
after.setData((short)0);
|
|
||||||
}
|
|
||||||
else if (after.getType() == Material.SMOOTH_BRICK)
|
|
||||||
{
|
|
||||||
after.setData(UtilMath.randomElement(new Short[] {1, 3}).shortValue());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
after.setData(UtilMath.randomElement(DyeColor.values()).getWoolData());
|
|
||||||
}
|
|
||||||
after.setAmount(old.getAmount());
|
|
||||||
|
|
||||||
return Pair.create(after.build(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void open(Player player)
|
|
||||||
{
|
|
||||||
Inventory newInv = Bukkit.createInventory(player, 27, "Builder's Box");
|
|
||||||
ItemStack border = new ItemBuilder(Material.STAINED_GLASS_PANE).setData((short)DyeColor.GRAY.getWoolData()).setTitle(C.cRed + " ").build();
|
|
||||||
ItemStack button = new ItemBuilder(Material.STAINED_GLASS_PANE).setData((short)DyeColor.LIME.getWoolData()).setTitle(C.cGreenB + "Convert").build();
|
|
||||||
for (int i = 0; i < 27; i++)
|
|
||||||
{
|
|
||||||
if (i == 22)
|
|
||||||
{
|
|
||||||
newInv.setItem(i, button);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (i < 9 || i > 17)
|
|
||||||
{
|
|
||||||
newInv.setItem(i, border);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
player.openInventory(newInv);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onClose(InventoryCloseEvent event)
|
|
||||||
{
|
|
||||||
InventoryView view = event.getView();
|
|
||||||
if (view.getTopInventory() != null)
|
|
||||||
{
|
|
||||||
Inventory top = view.getTopInventory();
|
|
||||||
if (top.getTitle().equals("Builder's Box"))
|
|
||||||
{
|
|
||||||
List<ItemStack> items = new ArrayList<>();
|
|
||||||
for (int i = 9; i < 18; i++)
|
|
||||||
{
|
|
||||||
items.add(top.getItem(i));
|
|
||||||
}
|
|
||||||
if (items != null && !items.isEmpty());
|
|
||||||
{
|
|
||||||
int totalChanged = 0;
|
|
||||||
for (Pair<ItemStack, Boolean> pair : items.stream().map(this::convert).collect(Collectors.toList()))
|
|
||||||
{
|
|
||||||
if (pair.getLeft() == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (pair.getRight())
|
|
||||||
{
|
|
||||||
totalChanged++;
|
|
||||||
}
|
|
||||||
event.getPlayer().getInventory().addItem(pair.getLeft());
|
|
||||||
}
|
|
||||||
if (totalChanged > 0)
|
|
||||||
{
|
|
||||||
ClansManager.getInstance().getInventoryManager().addItemToInventory((Player)event.getPlayer(), BoxType.BUILDER_BOX.getItemName(), -1);
|
|
||||||
UtilPlayer.message(event.getPlayer(), F.main("Builder's Box", "You have redeemed your box contents!"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onClick(InventoryClickEvent event)
|
|
||||||
{
|
|
||||||
if (event.getClickedInventory() != null && event.getClickedInventory().getTitle().equals("Builder's Box"))
|
|
||||||
{
|
|
||||||
if (event.getSlot() < 9 || event.getSlot() > 17)
|
|
||||||
{
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
if (event.getSlot() == 22)
|
|
||||||
{
|
|
||||||
event.getWhoClicked().closeInventory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +1,25 @@
|
|||||||
package mineplex.game.clans.clans.cash;
|
package mineplex.game.clans.clans.cash;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
|
||||||
import mineplex.core.Managers;
|
import mineplex.core.Managers;
|
||||||
import mineplex.core.common.skin.SkinData;
|
import mineplex.core.common.skin.SkinData;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.LineFormat;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.inventory.ClientInventory;
|
import mineplex.core.inventory.ClientInventory;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
|
import mineplex.core.shop.confirmation.ConfirmationCallback;
|
||||||
|
import mineplex.core.shop.confirmation.ConfirmationPage;
|
||||||
|
import mineplex.core.shop.confirmation.ConfirmationProcessor;
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.clans.amplifiers.AmplifierGUI;
|
import mineplex.game.clans.clans.amplifiers.AmplifierGUI;
|
||||||
@ -83,8 +90,35 @@ public class CashOverviewPage extends ShopPageBase<CashShopManager, CashShop>
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.closeInventory();
|
getShop().openPageForPlayer(player, new ConfirmationPage<>(player, this, new ConfirmationProcessor()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void init(Inventory inventory)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Field returnPage = ConfirmationPage.class.getDeclaredField("_returnPage");
|
||||||
|
returnPage.setAccessible(true);
|
||||||
|
returnPage.set(inventory, null);
|
||||||
|
returnPage.setAccessible(false);
|
||||||
|
}
|
||||||
|
catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(ConfirmationCallback callback)
|
||||||
|
{
|
||||||
BoxType.BUILDER_BOX.onUse(player);
|
BoxType.BUILDER_BOX.onUse(player);
|
||||||
|
callback.resolve("Opening Builder's Box...");
|
||||||
|
}
|
||||||
|
}, SkinData.CLANS_BUILDERS_BOX.getSkull(C.cRed + "Open Builder's Box", UtilText.splitLines(new String[]
|
||||||
|
{
|
||||||
|
C.cRed,
|
||||||
|
C.cRedB + "WARNING: " + C.cWhite + "This will convert all applicable items in your inventory!"
|
||||||
|
}, LineFormat.LORE)), "Confirm Opening Box"));
|
||||||
});
|
});
|
||||||
addButton(SUPPLY_BUTTON_SLOT, SkinData.CLANS_GILDED_SUPPLY_DROP.getSkull(C.cRed + "Supply Drop", Arrays.asList(
|
addButton(SUPPLY_BUTTON_SLOT, SkinData.CLANS_GILDED_SUPPLY_DROP.getSkull(C.cRed + "Supply Drop", Arrays.asList(
|
||||||
C.cYellow + "Call down Supply Drops to obtain",
|
C.cYellow + "Call down Supply Drops to obtain",
|
||||||
|
@ -124,9 +124,6 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
* enemy(caller, args);
|
* enemy(caller, args);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
else if (args[0].equalsIgnoreCase("territory") || args[0].equalsIgnoreCase("t"))
|
|
||||||
infoTerritory(caller, args);
|
|
||||||
|
|
||||||
else if (args[0].equalsIgnoreCase("who") || args[0].equalsIgnoreCase("w"))
|
else if (args[0].equalsIgnoreCase("who") || args[0].equalsIgnoreCase("w"))
|
||||||
{
|
{
|
||||||
if (args.length > 1)
|
if (args.length > 1)
|
||||||
@ -1195,33 +1192,4 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
|
|
||||||
_clansManager.getClanShop().openClanWho(caller, clan);
|
_clansManager.getClanShop().openClanWho(caller, clan);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void infoTerritory(Player caller, String[] args)
|
|
||||||
{
|
|
||||||
ClanInfo clan;
|
|
||||||
if (args.length < 2)
|
|
||||||
{
|
|
||||||
clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
|
||||||
|
|
||||||
if (clan == null)
|
|
||||||
{
|
|
||||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
clan = Plugin.getClanUtility().searchClan(caller, args[1], true);
|
|
||||||
|
|
||||||
if (clan == null) return;
|
|
||||||
|
|
||||||
if (_clansManager.getNetherManager().isInNether(caller))
|
|
||||||
{
|
|
||||||
_clansManager.message(caller, "You are currently in " + F.clansNether("The Nether") + ".");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UtilPlayer.message(caller, clan.mTerritory());
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -15,6 +15,6 @@ public class MapCommand extends CommandBase<ClansManager>
|
|||||||
@Override
|
@Override
|
||||||
public void Execute(Player caller, String[] args)
|
public void Execute(Player caller, String[] args)
|
||||||
{
|
{
|
||||||
//Plugin.getItemMapManager().setMap(caller);
|
Plugin.getItemMapManager().setMap(caller);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -77,7 +77,6 @@ public class ClansFreezeManager extends MiniPlugin
|
|||||||
|
|
||||||
private void generatePermissions()
|
private void generatePermissions()
|
||||||
{
|
{
|
||||||
|
|
||||||
PermissionGroup.CMOD.setPermission(Perm.FREEZE_COMMAND, false, true);
|
PermissionGroup.CMOD.setPermission(Perm.FREEZE_COMMAND, false, true);
|
||||||
PermissionGroup.CMA.setPermission(Perm.FREEZE_COMMAND, false, true);
|
PermissionGroup.CMA.setPermission(Perm.FREEZE_COMMAND, false, true);
|
||||||
PermissionGroup.ADMIN.setPermission(Perm.FREEZE_COMMAND, true, true);
|
PermissionGroup.ADMIN.setPermission(Perm.FREEZE_COMMAND, true, true);
|
||||||
|
@ -16,6 +16,10 @@ import com.mojang.authlib.GameProfile;
|
|||||||
import mineplex.core.command.CommandBase;
|
import mineplex.core.command.CommandBase;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.slack.SlackAPI;
|
||||||
|
import mineplex.core.slack.SlackMessage;
|
||||||
|
import mineplex.core.slack.SlackTeam;
|
||||||
import mineplex.game.clans.clans.invsee.InvseeManager;
|
import mineplex.game.clans.clans.invsee.InvseeManager;
|
||||||
|
|
||||||
public class InvseeCommand extends CommandBase<InvseeManager>
|
public class InvseeCommand extends CommandBase<InvseeManager>
|
||||||
@ -90,6 +94,9 @@ public class InvseeCommand extends CommandBase<InvseeManager>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SlackAPI.getInstance().sendMessage(SlackTeam.DEVELOPER, "#clans-commandspy",
|
||||||
|
new SlackMessage("Clans Command Logger", "crossed_swords", caller.getName() + " has started to invsee " + exactPlayer.getName() + " on " + UtilServer.getServerName() + "."),
|
||||||
|
true);
|
||||||
Plugin.doInvsee(exactPlayer, caller);
|
Plugin.doInvsee(exactPlayer, caller);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -175,11 +175,11 @@ public class LootManager
|
|||||||
private void populateCapturePoint()
|
private void populateCapturePoint()
|
||||||
{
|
{
|
||||||
// Food
|
// Food
|
||||||
_capturePointSet.add(5, new ItemLoot(Material.CARROT, 1, 5));
|
_capturePointSet.add(5, new ItemLoot(Material.CARROT, 32, 32));
|
||||||
_capturePointSet.add(5, new ItemLoot(Material.APPLE, 1, 3));
|
_capturePointSet.add(5, new ItemLoot(Material.APPLE, 32, 32));
|
||||||
_capturePointSet.add(5, new ItemLoot(Material.COOKED_BEEF, 1, 3));
|
_capturePointSet.add(5, new ItemLoot(Material.COOKED_BEEF, 32, 32));
|
||||||
_capturePointSet.add(5, new ItemLoot(Material.RAW_BEEF, 1, 4));
|
_capturePointSet.add(5, new ItemLoot(Material.RAW_BEEF, 32, 32));
|
||||||
_capturePointSet.add(5, new ItemLoot(Material.POTATO_ITEM, 1, 5));
|
_capturePointSet.add(5, new ItemLoot(Material.POTATO_ITEM, 32, 32));
|
||||||
|
|
||||||
// Armor
|
// Armor
|
||||||
_capturePointSet.add(3, new ItemLoot(Material.IRON_HELMET, 1, 1));
|
_capturePointSet.add(3, new ItemLoot(Material.IRON_HELMET, 1, 1));
|
||||||
@ -187,41 +187,41 @@ public class LootManager
|
|||||||
_capturePointSet.add(4, new ItemLoot(Material.IRON_LEGGINGS, 1, 1));
|
_capturePointSet.add(4, new ItemLoot(Material.IRON_LEGGINGS, 1, 1));
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.IRON_BOOTS, 1, 1));
|
_capturePointSet.add(4, new ItemLoot(Material.IRON_BOOTS, 1, 1));
|
||||||
|
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.GOLD_HELMET, 1, 1));
|
_capturePointSet.add(3, new ItemLoot(Material.GOLD_HELMET, 1, 1));
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.GOLD_CHESTPLATE, 1, 1));
|
_capturePointSet.add(3, new ItemLoot(Material.GOLD_CHESTPLATE, 1, 1));
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.GOLD_LEGGINGS, 1, 1));
|
_capturePointSet.add(4, new ItemLoot(Material.GOLD_LEGGINGS, 1, 1));
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.GOLD_BOOTS, 1, 1));
|
_capturePointSet.add(4, new ItemLoot(Material.GOLD_BOOTS, 1, 1));
|
||||||
|
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.LEATHER_HELMET, 1, 1));
|
_capturePointSet.add(3, new ItemLoot(Material.LEATHER_HELMET, 1, 1));
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.LEATHER_CHESTPLATE, 1, 1));
|
_capturePointSet.add(3, new ItemLoot(Material.LEATHER_CHESTPLATE, 1, 1));
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.LEATHER_LEGGINGS, 1, 1));
|
_capturePointSet.add(4, new ItemLoot(Material.LEATHER_LEGGINGS, 1, 1));
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.LEATHER_BOOTS, 1, 1));
|
_capturePointSet.add(4, new ItemLoot(Material.LEATHER_BOOTS, 1, 1));
|
||||||
|
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.DIAMOND_HELMET, 1, 1));
|
_capturePointSet.add(3, new ItemLoot(Material.DIAMOND_HELMET, 1, 1));
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.DIAMOND_CHESTPLATE, 1, 1));
|
_capturePointSet.add(3, new ItemLoot(Material.DIAMOND_CHESTPLATE, 1, 1));
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.DIAMOND_LEGGINGS, 1, 1));
|
_capturePointSet.add(4, new ItemLoot(Material.DIAMOND_LEGGINGS, 1, 1));
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.DIAMOND_BOOTS, 1, 1));
|
_capturePointSet.add(4, new ItemLoot(Material.DIAMOND_BOOTS, 1, 1));
|
||||||
|
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.CHAINMAIL_HELMET, 1, 1));
|
_capturePointSet.add(3, new ItemLoot(Material.CHAINMAIL_HELMET, 1, 1));
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.CHAINMAIL_CHESTPLATE, 1, 1));
|
_capturePointSet.add(3, new ItemLoot(Material.CHAINMAIL_CHESTPLATE, 1, 1));
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.CHAINMAIL_LEGGINGS, 1, 1));
|
_capturePointSet.add(4, new ItemLoot(Material.CHAINMAIL_LEGGINGS, 1, 1));
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.CHAINMAIL_BOOTS, 1, 1));
|
_capturePointSet.add(4, new ItemLoot(Material.CHAINMAIL_BOOTS, 1, 1));
|
||||||
|
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.IRON_AXE, 1, 1));
|
_capturePointSet.add(4, new ItemLoot(Material.IRON_AXE, 1, 1));
|
||||||
_capturePointSet.add(4, new ItemLoot(Material.IRON_SWORD, 1, 1));
|
_capturePointSet.add(4, new ItemLoot(Material.IRON_SWORD, 1, 1));
|
||||||
|
|
||||||
_capturePointSet.add(3, new ItemLoot(Material.EMERALD, 10, 15));
|
_capturePointSet.add(4, new ItemLoot(Material.EMERALD, 10, 15));
|
||||||
|
|
||||||
_capturePointSet.add(2, new CustomItemLoot(Material.GOLD_SWORD, 1, 1, "Booster Sword"));
|
_capturePointSet.add(3, new CustomItemLoot(Material.GOLD_SWORD, 1, 1, "Booster Sword"));
|
||||||
_capturePointSet.add(2, new CustomItemLoot(Material.GOLD_AXE, 1, 1, "Booster Axe"));
|
_capturePointSet.add(3, new CustomItemLoot(Material.GOLD_AXE, 1, 1, "Booster Axe"));
|
||||||
_capturePointSet.add(2, new CustomItemLoot(Material.DIAMOND_SWORD, 1, 1, "Power Sword"));
|
_capturePointSet.add(3, new CustomItemLoot(Material.DIAMOND_SWORD, 1, 1, "Power Sword"));
|
||||||
_capturePointSet.add(2, new CustomItemLoot(Material.DIAMOND_AXE, 1, 1, "Power Axe"));
|
_capturePointSet.add(3, new CustomItemLoot(Material.DIAMOND_AXE, 1, 1, "Power Axe"));
|
||||||
|
|
||||||
// Gold
|
// Gold
|
||||||
_capturePointSet.add(1, new GoldTokenLoot(50000, 50000));
|
_capturePointSet.add(1, new GoldTokenLoot(10000, 50000));
|
||||||
|
|
||||||
// Rune
|
// Rune
|
||||||
_capturePointSet.add(1, new RuneLoot());
|
_capturePointSet.add(2, new RuneLoot());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dropCommon(Location location)
|
public void dropCommon(Location location)
|
||||||
|
@ -5,6 +5,7 @@ import java.util.function.Consumer;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHorse;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHorse;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -26,6 +27,7 @@ import mineplex.core.common.util.UtilTime;
|
|||||||
import mineplex.core.common.util.particles.ColoredParticle;
|
import mineplex.core.common.util.particles.ColoredParticle;
|
||||||
import mineplex.core.common.util.particles.DustSpellColor;
|
import mineplex.core.common.util.particles.DustSpellColor;
|
||||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseBlock;
|
||||||
import mineplex.core.disguise.disguises.DisguiseCow;
|
import mineplex.core.disguise.disguises.DisguiseCow;
|
||||||
import mineplex.core.disguise.disguises.DisguiseSheep;
|
import mineplex.core.disguise.disguises.DisguiseSheep;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
@ -217,8 +219,9 @@ public class Mount
|
|||||||
horse.getInventory().setArmor(new ItemBuilder(Material.IRON_BARDING).setTitle(C.cGoldB + "Knightly Armor").build());
|
horse.getInventory().setArmor(new ItemBuilder(Material.IRON_BARDING).setTitle(C.cGoldB + "Knightly Armor").build());
|
||||||
}, horse ->
|
}, horse ->
|
||||||
{
|
{
|
||||||
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.APPLE, 0), horse.getLocation().add(0, 1, 0),
|
ColoredParticle red = new ColoredParticle(UtilParticle.ParticleType.RED_DUST,
|
||||||
0.25f, 0.25f, 0.25f, 0, 3, ViewDist.NORMAL);
|
new DustSpellColor(java.awt.Color.RED), horse.getLocation().add(0, 1, 0));
|
||||||
|
red.display(3);
|
||||||
}, MountType.HORSE),
|
}, MountType.HORSE),
|
||||||
COW(8, "Clans Cow Mount Skin", C.cWhite + "Cow", Material.MILK_BUCKET, Color.WHITE, Variant.HORSE, Style.NONE, true, horse ->
|
COW(8, "Clans Cow Mount Skin", C.cWhite + "Cow", Material.MILK_BUCKET, Color.WHITE, Variant.HORSE, Style.NONE, true, horse ->
|
||||||
{
|
{
|
||||||
@ -232,7 +235,36 @@ public class Mount
|
|||||||
disguise.setName(horse.getCustomName());
|
disguise.setName(horse.getCustomName());
|
||||||
ClansManager.getInstance().getDisguiseManager().disguise(disguise);
|
ClansManager.getInstance().getDisguiseManager().disguise(disguise);
|
||||||
}, horse -> {}, MountType.HORSE),
|
}, horse -> {}, MountType.HORSE),
|
||||||
TRUSTY_MULE(10, "Clans Trusty Mule Mount Skin", C.cBlue + "Trusty Mule", Material.APPLE, Color.BROWN, Variant.MULE, Style.NONE, false, horse -> {}, horse -> {}, MountType.DONKEY)
|
TRUSTY_MULE(10, "Clans Trusty Mule Mount Skin", C.cBlue + "Trusty Mule", Material.APPLE, Color.BROWN, Variant.MULE, Style.NONE, false, horse -> {}, horse -> {}, MountType.DONKEY),
|
||||||
|
CAKE(11, "Clans Cake Mount Skin", C.cPurple + "Cake", Material.CAKE, Color.WHITE, Variant.HORSE, Style.NONE, true, horse ->
|
||||||
|
{
|
||||||
|
DisguiseBlock disguise = new DisguiseBlock(horse, Material.CAKE_BLOCK, 0);
|
||||||
|
ClansManager.getInstance().getDisguiseManager().disguise(disguise);
|
||||||
|
}, horse ->
|
||||||
|
{
|
||||||
|
ColoredParticle red = new ColoredParticle(UtilParticle.ParticleType.RED_DUST,
|
||||||
|
new DustSpellColor(java.awt.Color.RED), horse.getLocation().add(0, 1, 0));
|
||||||
|
red.display(2);
|
||||||
|
ColoredParticle white = new ColoredParticle(UtilParticle.ParticleType.RED_DUST,
|
||||||
|
new DustSpellColor(java.awt.Color.WHITE), horse.getLocation().add(0, 1, 0));
|
||||||
|
white.display(3);
|
||||||
|
|
||||||
|
horse.getWorld().playSound(horse.getLocation(), Sound.EAT, 1, 1);
|
||||||
|
}, MountType.HORSE),
|
||||||
|
MELON(12, "Clans Power Melon Mount Skin", C.cGreen + "Power Melon", Material.MELON, Color.WHITE, Variant.HORSE, Style.NONE, true, horse ->
|
||||||
|
{
|
||||||
|
DisguiseBlock disguise = new DisguiseBlock(horse, Material.MELON_BLOCK, 0);
|
||||||
|
ClansManager.getInstance().getDisguiseManager().disguise(disguise);
|
||||||
|
UtilEnt.addFlag(horse, "HelmetPacket.RiderMelon");
|
||||||
|
}, horse ->
|
||||||
|
{
|
||||||
|
ColoredParticle red = new ColoredParticle(UtilParticle.ParticleType.RED_DUST,
|
||||||
|
new DustSpellColor(java.awt.Color.RED), horse.getLocation().add(0, 1, 0));
|
||||||
|
red.display(2);
|
||||||
|
ColoredParticle green = new ColoredParticle(UtilParticle.ParticleType.RED_DUST,
|
||||||
|
new DustSpellColor(java.awt.Color.GREEN), horse.getLocation().add(0, 1, 0));
|
||||||
|
green.display(3);
|
||||||
|
}, MountType.HORSE),
|
||||||
;
|
;
|
||||||
|
|
||||||
private final int _id;
|
private final int _id;
|
||||||
|
@ -11,6 +11,7 @@ import java.util.UUID;
|
|||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHorse;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHorse;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@ -27,6 +28,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
|||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||||
import org.bukkit.inventory.HorseInventory;
|
import org.bukkit.inventory.HorseInventory;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.spigotmc.event.entity.EntityDismountEvent;
|
import org.spigotmc.event.entity.EntityDismountEvent;
|
||||||
|
|
||||||
@ -49,6 +51,7 @@ import mineplex.core.updater.UpdateType;
|
|||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.ClanInfo;
|
import mineplex.game.clans.clans.ClanInfo;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.clans.HelmetPacketManager;
|
||||||
import mineplex.game.clans.clans.mounts.Mount.MountType;
|
import mineplex.game.clans.clans.mounts.Mount.MountType;
|
||||||
import mineplex.game.clans.clans.mounts.Mount.SkinType;
|
import mineplex.game.clans.clans.mounts.Mount.SkinType;
|
||||||
import mineplex.game.clans.clans.mounts.gui.MountShop;
|
import mineplex.game.clans.clans.mounts.gui.MountShop;
|
||||||
@ -185,7 +188,6 @@ public class MountManager extends MiniDbClientPlugin<MountOwnerData>
|
|||||||
|
|
||||||
private void generatePermissions()
|
private void generatePermissions()
|
||||||
{
|
{
|
||||||
|
|
||||||
PermissionGroup.PLAYER.setPermission(Perm.MOUNT_COMMAND, true, true);
|
PermissionGroup.PLAYER.setPermission(Perm.MOUNT_COMMAND, true, true);
|
||||||
PermissionGroup.ADMIN.setPermission(Perm.GIVE_MOUNT_COMMAND, true, true);
|
PermissionGroup.ADMIN.setPermission(Perm.GIVE_MOUNT_COMMAND, true, true);
|
||||||
PermissionGroup.ADMIN.setPermission(Perm.MOUNT_SKIN_UNLOCK, true, true);
|
PermissionGroup.ADMIN.setPermission(Perm.MOUNT_SKIN_UNLOCK, true, true);
|
||||||
@ -540,6 +542,10 @@ public class MountManager extends MiniDbClientPlugin<MountOwnerData>
|
|||||||
}
|
}
|
||||||
if (mount.getOwner().getEntityId() == event.getPlayer().getEntityId())
|
if (mount.getOwner().getEntityId() == event.getPlayer().getEntityId())
|
||||||
{
|
{
|
||||||
|
if (UtilEnt.hasFlag(event.getRightClicked(), "HelmetPacket.RiderMelon"))
|
||||||
|
{
|
||||||
|
HelmetPacketManager.getInstance().refreshToAll(event.getPlayer(), new ItemStack(Material.MELON_BLOCK));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -562,11 +568,16 @@ public class MountManager extends MiniDbClientPlugin<MountOwnerData>
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onDismount(EntityDismountEvent event)
|
public void onDismount(EntityDismountEvent event)
|
||||||
{
|
{
|
||||||
if (_spawnedMounts.containsKey(event.getDismounted()) && event.getEntity() instanceof Player)
|
if (_spawnedMounts.containsKey(event.getEntity()) && event.getDismounted() instanceof Player)
|
||||||
{
|
{
|
||||||
|
Player player = (Player) event.getDismounted();
|
||||||
runSyncLater(() ->
|
runSyncLater(() ->
|
||||||
{
|
{
|
||||||
event.getEntity().teleport(event.getDismounted());
|
player.teleport(event.getEntity());
|
||||||
|
if (UtilEnt.hasFlag(event.getEntity(), "HelmetPacket.RiderMelon"))
|
||||||
|
{
|
||||||
|
HelmetPacketManager.getInstance().refreshToAll(player, null);
|
||||||
|
}
|
||||||
}, 1L);
|
}, 1L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ public class MountSkinPage extends ShopPageBase<MountManager, MountShop>
|
|||||||
|
|
||||||
private ItemStack buildResetItem()
|
private ItemStack buildResetItem()
|
||||||
{
|
{
|
||||||
ItemBuilder builder = new ItemBuilder(Material.WATER_BUCKET);
|
ItemBuilder builder = new ItemBuilder(Material.PAPER);
|
||||||
|
|
||||||
builder.setTitle(C.cYellow + "Default Skin");
|
builder.setTitle(C.cYellow + "Default Skin");
|
||||||
if (_token.Skin == null)
|
if (_token.Skin == null)
|
||||||
|
@ -6,6 +6,9 @@ import mineplex.core.command.CommandBase;
|
|||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.slack.SlackAPI;
|
||||||
|
import mineplex.core.slack.SlackMessage;
|
||||||
|
import mineplex.core.slack.SlackTeam;
|
||||||
import mineplex.game.clans.clans.nameblacklist.ClansBlacklist;
|
import mineplex.game.clans.clans.nameblacklist.ClansBlacklist;
|
||||||
|
|
||||||
public class AddBlacklistCommand extends CommandBase<ClansBlacklist>
|
public class AddBlacklistCommand extends CommandBase<ClansBlacklist>
|
||||||
@ -30,6 +33,9 @@ public class AddBlacklistCommand extends CommandBase<ClansBlacklist>
|
|||||||
{
|
{
|
||||||
Plugin.getRepository().add(blacklist, caller.getName());
|
Plugin.getRepository().add(blacklist, caller.getName());
|
||||||
UtilPlayer.message(caller, F.main("Clans", "Successfully added " + F.elem(blacklist) + " to the clan name blacklist."));
|
UtilPlayer.message(caller, F.main("Clans", "Successfully added " + F.elem(blacklist) + " to the clan name blacklist."));
|
||||||
|
SlackAPI.getInstance().sendMessage(SlackTeam.DEVELOPER, "#clans-commandspy",
|
||||||
|
new SlackMessage("Clans Command Logger", "crossed_swords", caller.getName() + " has blacklisted the clan name " + blacklist + "."),
|
||||||
|
true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -41,6 +41,7 @@ import mineplex.core.common.util.C;
|
|||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTextMiddle;
|
import mineplex.core.common.util.UtilTextMiddle;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||||
@ -494,13 +495,10 @@ public class NetherManager extends MiniPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// UtilServer.getPlayersCollection()
|
UtilServer.getPlayersCollection()
|
||||||
// .stream()
|
.stream()
|
||||||
// .filter(player -> isInNether(player))
|
.filter(player -> isInNether(player))
|
||||||
// .forEach(player ->
|
.forEach(player -> ClansManager.getInstance().getItemMapManager().removeMap(player));
|
||||||
// {
|
|
||||||
// ClansManager.getInstance().getItemMapManager().removeMap(player);
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@ public class ObserverManager extends MiniPlugin
|
|||||||
UtilPlayer.clearInventory(player);
|
UtilPlayer.clearInventory(player);
|
||||||
UtilPlayer.clearPotionEffects(player);
|
UtilPlayer.clearPotionEffects(player);
|
||||||
player.setGameMode(GameMode.CREATIVE);
|
player.setGameMode(GameMode.CREATIVE);
|
||||||
|
ClansManager.getInstance().getGearManager().getPlayerGear(player).updateCache(true);
|
||||||
_observerMap.put(player, data);
|
_observerMap.put(player, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,17 +3,29 @@ package mineplex.game.clans.clans.pvptimer;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
||||||
@ -21,10 +33,20 @@ import mineplex.core.account.permissions.Permission;
|
|||||||
import mineplex.core.account.permissions.PermissionGroup;
|
import mineplex.core.account.permissions.PermissionGroup;
|
||||||
import mineplex.core.command.CommandBase;
|
import mineplex.core.command.CommandBase;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.core.common.util.UtilWorld;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import mineplex.core.slack.SlackAPI;
|
||||||
|
import mineplex.core.slack.SlackMessage;
|
||||||
|
import mineplex.core.slack.SlackTeam;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.core.repository.ClanTerritory;
|
||||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
@ -88,6 +110,9 @@ public class PvPTimerManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
disableTimer(target, true, true);
|
disableTimer(target, true, true);
|
||||||
UtilPlayer.message(caller, F.main(getName(), F.elem(target.getName()) + " no longer has a PvP Timer!"));
|
UtilPlayer.message(caller, F.main(getName(), F.elem(target.getName()) + " no longer has a PvP Timer!"));
|
||||||
|
SlackAPI.getInstance().sendMessage(SlackTeam.DEVELOPER, "#clans-commandspy",
|
||||||
|
new SlackMessage("Clans Command Logger", "crossed_swords", caller.getName() + " has removed " + target.getName() + "'s PvP Timer on " + UtilServer.getServerName() + "."),
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -184,6 +209,35 @@ public class PvPTimerManager extends MiniPlugin
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public boolean handleMining(Player player, Block block, boolean playSound)
|
||||||
|
{
|
||||||
|
if (!hasTimer(player))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
||||||
|
Function<Collection<ItemStack>, ItemStack[]> converter = (collection) ->
|
||||||
|
{
|
||||||
|
ItemStack[] array = new ItemStack[collection.size()];
|
||||||
|
int i = 0;
|
||||||
|
for (ItemStack item : collection)
|
||||||
|
{
|
||||||
|
array[i++] = item;
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
};
|
||||||
|
BiConsumer<Integer, ItemStack> dropper = (integer, item) ->
|
||||||
|
{
|
||||||
|
block.getWorld().dropItemNaturally(block.getLocation().add(0.5, 0.3, 0.5), item);
|
||||||
|
};
|
||||||
|
Collection<ItemStack> drops = block.getDrops(player.getItemInHand());
|
||||||
|
player.getInventory().addItem(converter.apply(drops)).forEach(dropper);
|
||||||
|
block.setType(Material.AIR);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onJoin(PlayerJoinEvent event)
|
public void onJoin(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
@ -244,7 +298,7 @@ public class PvPTimerManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
if (event.GetDamageePlayer() != null)
|
if (event.GetDamageePlayer() != null)
|
||||||
{
|
{
|
||||||
if (hasTimer(event.GetDamageePlayer()))
|
if (hasTimer(event.GetDamageePlayer()) && event.GetDamagerPlayer(true) != null)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(event.GetDamagerPlayer(true), F.main(getName(), "You cannot harm " + F.elem(event.GetDamageePlayer().getName()) + "!"));
|
UtilPlayer.message(event.GetDamagerPlayer(true), F.main(getName(), "You cannot harm " + F.elem(event.GetDamageePlayer().getName()) + "!"));
|
||||||
event.SetCancelled("PvP Timer");
|
event.SetCancelled("PvP Timer");
|
||||||
@ -259,4 +313,66 @@ public class PvPTimerManager extends MiniPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onPickup(PlayerPickupItemEvent event)
|
||||||
|
{
|
||||||
|
if (hasTimer(event.getPlayer()))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
if (Recharge.Instance.use(event.getPlayer(), "PvP Timer Inform NoPickup", 5000, false, false))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(event.getPlayer(), F.main(getName(), "You cannot pick up items whilst protected from PvP. Run " + F.elem("/pvp") + " to enable PvP!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onBlockBreak(BlockBreakEvent event)
|
||||||
|
{
|
||||||
|
if (handleMining(event.getPlayer(), event.getBlock(), true))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
public void onEnter(PlayerMoveEvent event)
|
||||||
|
{
|
||||||
|
if (!hasTimer(event.getPlayer()) || UtilWorld.areChunksEqual(event.getFrom(), event.getTo()) || ClansManager.getInstance().getClanUtility().isAdmin(event.getTo()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ClanTerritory claimTo = ClansManager.getInstance().getClanUtility().getClaim(event.getTo());
|
||||||
|
ClanTerritory claimFrom = ClansManager.getInstance().getClanUtility().getClaim(event.getFrom());
|
||||||
|
|
||||||
|
if (claimTo != null)
|
||||||
|
{
|
||||||
|
if (claimFrom == null || !claimFrom.Owner.equals(claimTo.Owner))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(event.getPlayer(), F.main(getName(), "You cannot enter claimed land whilst protected from PvP. Run " + F.elem("/pvp") + " to enable PvP!"));
|
||||||
|
UtilAction.velocity(event.getPlayer(), UtilAlg.getTrajectory(event.getTo(), event.getFrom()).multiply(4), 1.5, true, 0.8, 0, 1.0, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onTeleportInto(PlayerTeleportEvent event)
|
||||||
|
{
|
||||||
|
if (!hasTimer(event.getPlayer()) || UtilWorld.areChunksEqual(event.getFrom(), event.getTo()) || ClansManager.getInstance().getClanUtility().isAdmin(event.getTo()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ClanTerritory claimTo = ClansManager.getInstance().getClanUtility().getClaim(event.getTo());
|
||||||
|
ClanTerritory claimFrom = ClansManager.getInstance().getClanUtility().getClaim(event.getFrom());
|
||||||
|
|
||||||
|
if (claimTo != null)
|
||||||
|
{
|
||||||
|
if (claimFrom == null || !claimFrom.Owner.equals(claimTo.Owner))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(event.getPlayer(), F.main(getName(), "You cannot enter claimed land whilst protected from PvP. Run " + F.elem("/pvp") + " to enable PvP!"));
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -73,7 +73,8 @@ public class SiegeManager extends MiniPlugin
|
|||||||
|
|
||||||
getRepository().getWeaponsByServer(getClansManager().getServerId(), tokens ->
|
getRepository().getWeaponsByServer(getClansManager().getServerId(), tokens ->
|
||||||
tokens.forEach(token ->
|
tokens.forEach(token ->
|
||||||
runSync(() -> {
|
runSync(() ->
|
||||||
|
{
|
||||||
final SiegeWeapon weapon;
|
final SiegeWeapon weapon;
|
||||||
|
|
||||||
token.Location.getChunk().load();
|
token.Location.getChunk().load();
|
||||||
@ -102,7 +103,6 @@ public class SiegeManager extends MiniPlugin
|
|||||||
|
|
||||||
private void generatePermissions()
|
private void generatePermissions()
|
||||||
{
|
{
|
||||||
|
|
||||||
PermissionGroup.ADMIN.setPermission(Perm.GIVE_CANNON_COMMAND, true, true);
|
PermissionGroup.ADMIN.setPermission(Perm.GIVE_CANNON_COMMAND, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import mineplex.core.common.Pair;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.ColorFader;
|
import mineplex.core.common.util.ColorFader;
|
||||||
import mineplex.core.common.util.EnclosedObject;
|
import mineplex.core.common.util.EnclosedObject;
|
||||||
@ -272,9 +273,13 @@ public class Outpost implements Listener
|
|||||||
UtilTextMiddle.display("Siege", "Your Outpost has been destroyed", 20, 100, 20, _ownerClan.getOnlinePlayersArray());
|
UtilTextMiddle.display("Siege", "Your Outpost has been destroyed", 20, 100, 20, _ownerClan.getOnlinePlayersArray());
|
||||||
|
|
||||||
if (getState() == OutpostState.AWAITING)
|
if (getState() == OutpostState.AWAITING)
|
||||||
|
{
|
||||||
cleanup();
|
cleanup();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
kill();
|
kill();
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -396,9 +401,13 @@ public class Outpost implements Listener
|
|||||||
UtilTextMiddle.display("Siege", "Your Outpost has been destroyed", 20, 100, 20, _ownerClan.getOnlinePlayersArray());
|
UtilTextMiddle.display("Siege", "Your Outpost has been destroyed", 20, 100, 20, _ownerClan.getOnlinePlayersArray());
|
||||||
|
|
||||||
if (getState() == OutpostState.AWAITING)
|
if (getState() == OutpostState.AWAITING)
|
||||||
|
{
|
||||||
cleanup();
|
cleanup();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
kill();
|
kill();
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -443,9 +452,13 @@ public class Outpost implements Listener
|
|||||||
UtilTextMiddle.display("Siege", "Your Outpost has been destroyed", 20, 100, 20, _ownerClan.getOnlinePlayersArray());
|
UtilTextMiddle.display("Siege", "Your Outpost has been destroyed", 20, 100, 20, _ownerClan.getOnlinePlayersArray());
|
||||||
|
|
||||||
if (getState() == OutpostState.AWAITING)
|
if (getState() == OutpostState.AWAITING)
|
||||||
|
{
|
||||||
cleanup();
|
cleanup();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
kill();
|
kill();
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -731,6 +744,11 @@ public class Outpost implements Listener
|
|||||||
return UtilAlg.toBoundingBox(_startCorner, _endCorner);
|
return UtilAlg.toBoundingBox(_startCorner, _endCorner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Pair<Location, Location> getBoundsBlockBreak()
|
||||||
|
{
|
||||||
|
return Pair.create(_startCorner.clone().subtract(0.5, 0, 0.5), _endCorner.clone());
|
||||||
|
}
|
||||||
|
|
||||||
public Location getExactMiddle()
|
public Location getExactMiddle()
|
||||||
{
|
{
|
||||||
return UtilAlg.getMidpoint(_startCorner, _endCorner);
|
return UtilAlg.getMidpoint(_startCorner, _endCorner);
|
||||||
|
@ -210,8 +210,10 @@ public class OutpostManager extends MiniPlugin
|
|||||||
public void onBlockFall(EntityChangeBlockEvent event)
|
public void onBlockFall(EntityChangeBlockEvent event)
|
||||||
{
|
{
|
||||||
if (event.getEntity().hasMetadata("ClansOutpost"))
|
if (event.getEntity().hasMetadata("ClansOutpost"))
|
||||||
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onClaim(PlayerClaimTerritoryEvent event)
|
public void onClaim(PlayerClaimTerritoryEvent event)
|
||||||
@ -281,7 +283,8 @@ public class OutpostManager extends MiniPlugin
|
|||||||
System.out.println("[OUTPOSTS] LOADING OUTPOSTS FROM DATABASE");
|
System.out.println("[OUTPOSTS] LOADING OUTPOSTS FROM DATABASE");
|
||||||
|
|
||||||
_repository.getOutpostsByServer(_clansManager.getServerId(), tokens ->
|
_repository.getOutpostsByServer(_clansManager.getServerId(), tokens ->
|
||||||
tokens.forEach(token -> {
|
tokens.forEach(token ->
|
||||||
|
{
|
||||||
Outpost outpost = new Outpost(this, token);
|
Outpost outpost = new Outpost(this, token);
|
||||||
|
|
||||||
if ((System.currentTimeMillis() - token.TimeSpawned) > Outpost.MAX_LIFETIME)
|
if ((System.currentTimeMillis() - token.TimeSpawned) > Outpost.MAX_LIFETIME)
|
||||||
|
@ -359,7 +359,8 @@ public class Cannon extends SiegeWeapon
|
|||||||
public void FindEntities()
|
public void FindEntities()
|
||||||
{
|
{
|
||||||
Lists.newArrayList(_location.getWorld().getEntities())
|
Lists.newArrayList(_location.getWorld().getEntities())
|
||||||
.forEach(entity -> {
|
.forEach(entity ->
|
||||||
|
{
|
||||||
if (Integer.toString(_uniqueId).equals(entity.getCustomName()))
|
if (Integer.toString(_uniqueId).equals(entity.getCustomName()))
|
||||||
{
|
{
|
||||||
entity.remove();
|
entity.remove();
|
||||||
|
@ -38,6 +38,7 @@ import mineplex.core.common.util.NautArrayList;
|
|||||||
import mineplex.core.common.util.NautHashMap;
|
import mineplex.core.common.util.NautHashMap;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilCollections;
|
import mineplex.core.common.util.UtilCollections;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilItem;
|
import mineplex.core.common.util.UtilItem;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
@ -66,6 +67,7 @@ import mineplex.game.clans.items.legendaries.AlligatorsTooth;
|
|||||||
import mineplex.game.clans.items.legendaries.DemonicScythe;
|
import mineplex.game.clans.items.legendaries.DemonicScythe;
|
||||||
import mineplex.game.clans.items.legendaries.GiantsBroadsword;
|
import mineplex.game.clans.items.legendaries.GiantsBroadsword;
|
||||||
import mineplex.game.clans.items.legendaries.HyperAxe;
|
import mineplex.game.clans.items.legendaries.HyperAxe;
|
||||||
|
import mineplex.game.clans.items.legendaries.KnightLance;
|
||||||
import mineplex.game.clans.items.legendaries.LegendaryItem;
|
import mineplex.game.clans.items.legendaries.LegendaryItem;
|
||||||
import mineplex.game.clans.items.legendaries.MagneticMaul;
|
import mineplex.game.clans.items.legendaries.MagneticMaul;
|
||||||
import mineplex.game.clans.items.legendaries.WindBlade;
|
import mineplex.game.clans.items.legendaries.WindBlade;
|
||||||
@ -165,7 +167,8 @@ public abstract class SiegeWeapon implements Listener
|
|||||||
_infoHologram = new Hologram(ClansManager.getInstance().getHologramManager(), _location.clone().add(.5, 3, .5), _name + " Health", getDisplayHealth());
|
_infoHologram = new Hologram(ClansManager.getInstance().getHologramManager(), _location.clone().add(.5, 3, .5), _name + " Health", getDisplayHealth());
|
||||||
_infoHologram.start();
|
_infoHologram.start();
|
||||||
|
|
||||||
_infoHologram.setInteraction((player, type) -> {
|
_infoHologram.setInteraction((player, type) ->
|
||||||
|
{
|
||||||
if (type.equals(ClickType.LEFT))
|
if (type.equals(ClickType.LEFT))
|
||||||
{
|
{
|
||||||
handleLeftClick(player);
|
handleLeftClick(player);
|
||||||
@ -226,18 +229,22 @@ public abstract class SiegeWeapon implements Listener
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (gear.getWeapon() != null && gear.getWeapon() instanceof LegendaryItem)
|
if (gear.getWeapon() != null && gear.getWeapon() instanceof LegendaryItem)
|
||||||
|
{
|
||||||
if (gear.getWeapon() instanceof AlligatorsTooth)
|
if (gear.getWeapon() instanceof AlligatorsTooth)
|
||||||
return 8;
|
return 8;
|
||||||
else if (gear.getWeapon() instanceof GiantsBroadsword)
|
else if (gear.getWeapon() instanceof GiantsBroadsword)
|
||||||
return 10;
|
return 10;
|
||||||
else if (gear.getWeapon() instanceof HyperAxe)
|
else if (gear.getWeapon() instanceof HyperAxe)
|
||||||
return 3;
|
return 6;
|
||||||
else if (gear.getWeapon() instanceof MagneticMaul)
|
else if (gear.getWeapon() instanceof MagneticMaul)
|
||||||
return 8;
|
return 8;
|
||||||
else if (gear.getWeapon() instanceof WindBlade)
|
else if (gear.getWeapon() instanceof WindBlade)
|
||||||
return 7;
|
return 7;
|
||||||
else if (gear.getWeapon() instanceof DemonicScythe)
|
else if (gear.getWeapon() instanceof DemonicScythe)
|
||||||
return 8;
|
return 8;
|
||||||
|
else if (gear.getWeapon() instanceof KnightLance)
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
return (int) UtilItem.getAttackDamage(stack.getType());
|
return (int) UtilItem.getAttackDamage(stack.getType());
|
||||||
}
|
}
|
||||||
@ -407,7 +414,8 @@ public abstract class SiegeWeapon implements Listener
|
|||||||
{
|
{
|
||||||
System.out.println("Killing: " + this.getClass().getSimpleName() + " [" + _uniqueId + "]");
|
System.out.println("Killing: " + this.getClass().getSimpleName() + " [" + _uniqueId + "]");
|
||||||
|
|
||||||
_siegeManager.runSync(() -> {
|
_siegeManager.runSync(() ->
|
||||||
|
{
|
||||||
CustomCleanup();
|
CustomCleanup();
|
||||||
|
|
||||||
_comprisedOf.forEach(Entity::remove);
|
_comprisedOf.forEach(Entity::remove);
|
||||||
@ -572,6 +580,7 @@ public abstract class SiegeWeapon implements Listener
|
|||||||
entity.setCustomName(Integer.toString(_uniqueId));
|
entity.setCustomName(Integer.toString(_uniqueId));
|
||||||
entity.setCustomNameVisible(false);
|
entity.setCustomNameVisible(false);
|
||||||
entity.setMetadata("Creature.DoNotDrop", new FixedMetadataValue(_clans.getPlugin(), true));
|
entity.setMetadata("Creature.DoNotDrop", new FixedMetadataValue(_clans.getPlugin(), true));
|
||||||
|
UtilEnt.addFlag(entity, "LegendaryAbility.IgnoreMe");
|
||||||
|
|
||||||
_comprisedOf.add(entity);
|
_comprisedOf.add(entity);
|
||||||
|
|
||||||
@ -583,6 +592,7 @@ public abstract class SiegeWeapon implements Listener
|
|||||||
Entity entity = _entityMapping.get(uniqueName);
|
Entity entity = _entityMapping.get(uniqueName);
|
||||||
|
|
||||||
entity.removeMetadata("Creature.DoNotDrop", _clans.getPlugin());
|
entity.removeMetadata("Creature.DoNotDrop", _clans.getPlugin());
|
||||||
|
UtilEnt.removeFlag(entity, "LegendaryAbility.IgnoreMe");
|
||||||
|
|
||||||
_entityMapping.remove(uniqueName);
|
_entityMapping.remove(uniqueName);
|
||||||
_comprisedOf.remove(entity);
|
_comprisedOf.remove(entity);
|
||||||
|
@ -274,7 +274,7 @@ public class SupplyDropManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
ItemStack item = set.generateRandom().get();
|
ItemStack item = set.generateRandom().get();
|
||||||
items.add(set.generateRandom().get());
|
items.add(set.generateRandom().get());
|
||||||
if (item.getType() == Material.RECORD_12)
|
if (item.getType() == Material.RABBIT_FOOT)
|
||||||
{
|
{
|
||||||
set.remove(gold);
|
set.remove(gold);
|
||||||
}
|
}
|
||||||
@ -351,7 +351,7 @@ public class SupplyDropManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
ItemStack item = set.generateRandom().get();
|
ItemStack item = set.generateRandom().get();
|
||||||
items.add(set.generateRandom().get());
|
items.add(set.generateRandom().get());
|
||||||
if (item.getType() == Material.RECORD_12)
|
if (item.getType() == Material.RABBIT_FOOT)
|
||||||
{
|
{
|
||||||
if (++golds > 1)
|
if (++golds > 1)
|
||||||
{
|
{
|
||||||
|
@ -12,12 +12,14 @@ import org.bukkit.util.Vector;
|
|||||||
|
|
||||||
import mineplex.core.blockrestore.BlockRestore;
|
import mineplex.core.blockrestore.BlockRestore;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.disguise.DisguiseManager;
|
import mineplex.core.disguise.DisguiseManager;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
import mineplex.core.projectile.ProjectileManager;
|
import mineplex.core.projectile.ProjectileManager;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
@ -79,6 +81,14 @@ public abstract class BossWorldEvent<T extends EventCreature<?>> extends WorldEv
|
|||||||
{
|
{
|
||||||
for (Player player : UtilPlayer.getInRadius(from, TELEPORT_PAD_RANGE).keySet())
|
for (Player player : UtilPlayer.getInRadius(from, TELEPORT_PAD_RANGE).keySet())
|
||||||
{
|
{
|
||||||
|
if (ClansManager.getInstance().hasTimer(player))
|
||||||
|
{
|
||||||
|
if (Recharge.Instance.use(player, "PvP Timer Inform NoBoss", 5000, false, false))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, F.main(getName(), "You cannot enter a World Boss whilst protected from PvP. Run " + F.elem("/pvp") + " to enable PvP!"));
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
player.teleport(UtilMath.randomElement(_teleportTo));
|
player.teleport(UtilMath.randomElement(_teleportTo));
|
||||||
for (ISkill skill : ClansManager.getInstance().getClassManager().Get(player).GetSkills())
|
for (ISkill skill : ClansManager.getInstance().getClassManager().Get(player).GetSkills())
|
||||||
{
|
{
|
||||||
|
@ -28,6 +28,7 @@ import mineplex.core.common.util.UtilServer;
|
|||||||
import mineplex.core.disguise.DisguiseManager;
|
import mineplex.core.disguise.DisguiseManager;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
import mineplex.core.projectile.ProjectileManager;
|
import mineplex.core.projectile.ProjectileManager;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.core.utils.UtilScheduler;
|
import mineplex.core.utils.UtilScheduler;
|
||||||
@ -67,7 +68,6 @@ public class RaidManager extends MiniPlugin
|
|||||||
|
|
||||||
private void generatePermissions()
|
private void generatePermissions()
|
||||||
{
|
{
|
||||||
|
|
||||||
PermissionGroup.ADMIN.setPermission(Perm.START_RAID_COMMAND, true, true);
|
PermissionGroup.ADMIN.setPermission(Perm.START_RAID_COMMAND, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,6 +78,20 @@ public class RaidManager extends MiniPlugin
|
|||||||
_raids.clear();
|
_raids.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isEligible(Player player)
|
||||||
|
{
|
||||||
|
if (ClansManager.getInstance().hasTimer(player))
|
||||||
|
{
|
||||||
|
if (Recharge.Instance.use(player, "PvP Timer Inform NoRaid", 5000, false, false))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, F.main(getName(), "You cannot enter a Raid whilst protected from PvP. Run " + F.elem("/pvp") + " to enable PvP!"));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public DisguiseManager getDisguiseManager()
|
public DisguiseManager getDisguiseManager()
|
||||||
{
|
{
|
||||||
return ClansManager.getInstance().getDisguiseManager();
|
return ClansManager.getInstance().getDisguiseManager();
|
||||||
@ -129,6 +143,7 @@ public class RaidManager extends MiniPlugin
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Set<Player> inside = UtilPlayer.getInRadius(player.getLocation(), 4).keySet();
|
Set<Player> inside = UtilPlayer.getInRadius(player.getLocation(), 4).keySet();
|
||||||
|
inside.removeIf(this::isEligible);
|
||||||
if (inside.size() > MAX_PARTICIPANTS)
|
if (inside.size() > MAX_PARTICIPANTS)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, F.main(type.getRaidName() + " Raid", "You cannot start a raid with more than " + MAX_PARTICIPANTS + " participants!"));
|
UtilPlayer.message(player, F.main(type.getRaidName() + " Raid", "You cannot start a raid with more than " + MAX_PARTICIPANTS + " participants!"));
|
||||||
@ -172,17 +187,14 @@ public class RaidManager extends MiniPlugin
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void update(UpdateEvent event)
|
public void update(UpdateEvent event)
|
||||||
{
|
{
|
||||||
// if (event.getType() == UpdateType.TICK)
|
if (event.getType() == UpdateType.TICK)
|
||||||
// {
|
{
|
||||||
// UtilServer.getPlayersCollection()
|
UtilServer.getPlayersCollection()
|
||||||
// .stream()
|
.stream()
|
||||||
// .filter(player -> isInRaid(player.getLocation()))
|
.filter(player -> isInRaid(player.getLocation()))
|
||||||
// .forEach(player ->
|
.forEach(player -> ClansManager.getInstance().getItemMapManager().removeMap(player));
|
||||||
// {
|
return;
|
||||||
// ClansManager.getInstance().getItemMapManager().removeMap(player);
|
}
|
||||||
// });
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
if (event.getType() != UpdateType.SEC)
|
if (event.getType() != UpdateType.SEC)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -158,7 +158,9 @@ public class GoldManager extends MiniDbClientPlugin<GoldData>
|
|||||||
|
|
||||||
int pickupMapGold = goldAmount;
|
int pickupMapGold = goldAmount;
|
||||||
if (_playerPickupMap.containsKey(event.getPlayer()))
|
if (_playerPickupMap.containsKey(event.getPlayer()))
|
||||||
|
{
|
||||||
pickupMapGold += _playerPickupMap.get(event.getPlayer());
|
pickupMapGold += _playerPickupMap.get(event.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
_playerPickupMap.put(event.getPlayer(), pickupMapGold);
|
_playerPickupMap.put(event.getPlayer(), pickupMapGold);
|
||||||
}
|
}
|
||||||
@ -305,7 +307,7 @@ public class GoldManager extends MiniDbClientPlugin<GoldData>
|
|||||||
final GoldToken token = new GoldToken(tokenValue);
|
final GoldToken token = new GoldToken(tokenValue);
|
||||||
deductGold(success ->
|
deductGold(success ->
|
||||||
{
|
{
|
||||||
if (success.booleanValue())
|
if (success)
|
||||||
{
|
{
|
||||||
player.getInventory().addItem(token.toItemStack());
|
player.getInventory().addItem(token.toItemStack());
|
||||||
GoldManager.notify(player, String.format("You have purchased a gold token worth %dg!", tokenValue));
|
GoldManager.notify(player, String.format("You have purchased a gold token worth %dg!", tokenValue));
|
||||||
|
@ -226,7 +226,7 @@ public class FieldOre extends MiniPlugin
|
|||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
ore.OreMined(event.getPlayer().getEyeLocation());
|
ore.OreMined(event.getPlayer(), event.getPlayer().getEyeLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -7,12 +7,15 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import mineplex.core.Managers;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
import mineplex.game.clans.clans.pvptimer.PvPTimerManager;
|
||||||
|
|
||||||
public class FieldOreData
|
public class FieldOreData
|
||||||
{
|
{
|
||||||
@ -78,10 +81,10 @@ public class FieldOreData
|
|||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OreMined(Location source)
|
public void OreMined(Player player, Location source)
|
||||||
{
|
{
|
||||||
//Persist
|
//Persist
|
||||||
OreLoot(source);
|
OreLoot(player, source);
|
||||||
|
|
||||||
if (Math.random() > 0.9)
|
if (Math.random() > 0.9)
|
||||||
return;
|
return;
|
||||||
@ -94,7 +97,8 @@ public class FieldOreData
|
|||||||
_active = false;
|
_active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OreLoot(Location source)
|
@SuppressWarnings("deprecation")
|
||||||
|
public void OreLoot(Player player, Location source)
|
||||||
{
|
{
|
||||||
ItemStack stack = null;
|
ItemStack stack = null;
|
||||||
|
|
||||||
@ -110,13 +114,18 @@ public class FieldOreData
|
|||||||
else if (block.getType() == Material.REDSTONE_ORE) stack = ItemStackFactory.Instance.CreateStack(Material.REDSTONE, 3);
|
else if (block.getType() == Material.REDSTONE_ORE) stack = ItemStackFactory.Instance.CreateStack(Material.REDSTONE, 3);
|
||||||
|
|
||||||
if (stack == null)
|
if (stack == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Managers.get(PvPTimerManager.class).handleMining(player, block, false))
|
||||||
|
{
|
||||||
Vector vec = UtilAlg.getTrajectory(_loc.getBlock().getLocation().add(0.5, 0.5, 0.5), source).normalize();
|
Vector vec = UtilAlg.getTrajectory(_loc.getBlock().getLocation().add(0.5, 0.5, 0.5), source).normalize();
|
||||||
|
|
||||||
Item item = _loc.getWorld().dropItem(_loc.getBlock().getLocation().add(0.5, 0.5, 0.5).add(vec), stack);
|
Item item = _loc.getWorld().dropItem(_loc.getBlock().getLocation().add(0.5, 0.5, 0.5).add(vec), stack);
|
||||||
item.setPickupDelay(40);
|
item.setPickupDelay(40);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void StartVein(int veinSize)
|
public void StartVein(int veinSize)
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,7 @@ package mineplex.game.clans.gameplay;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
@ -12,6 +13,7 @@ import org.bukkit.Sound;
|
|||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.CraftChunk;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.ItemFrame;
|
import org.bukkit.entity.ItemFrame;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -43,7 +45,6 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
import mineplex.core.blockrestore.BlockRestore;
|
import mineplex.core.blockrestore.BlockRestore;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilBlock;
|
|
||||||
import mineplex.core.common.util.UtilEvent;
|
import mineplex.core.common.util.UtilEvent;
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
import mineplex.core.common.util.UtilInv;
|
import mineplex.core.common.util.UtilInv;
|
||||||
@ -71,6 +72,7 @@ public class Gameplay extends MiniPlugin
|
|||||||
private static final int MAX_BUILD_HEIGHT = 120;
|
private static final int MAX_BUILD_HEIGHT = 120;
|
||||||
private static final int MIN_CHEST_HEIGHT = 30;
|
private static final int MIN_CHEST_HEIGHT = 30;
|
||||||
private static final Material[] REDSTONE_TYPES = new Material[] {Material.ACTIVATOR_RAIL, Material.REDSTONE, Material.REDSTONE_BLOCK, Material.REDSTONE_COMPARATOR, Material.REDSTONE_WIRE, Material.REDSTONE_COMPARATOR_OFF, Material.REDSTONE_COMPARATOR_ON, Material.REDSTONE_LAMP_OFF, Material.REDSTONE_LAMP_ON, Material.REDSTONE_TORCH_OFF, Material.REDSTONE_TORCH_ON, Material.DIODE, Material.DIODE_BLOCK_OFF, Material.DIODE_BLOCK_ON, Material.DETECTOR_RAIL};
|
private static final Material[] REDSTONE_TYPES = new Material[] {Material.ACTIVATOR_RAIL, Material.REDSTONE, Material.REDSTONE_BLOCK, Material.REDSTONE_COMPARATOR, Material.REDSTONE_WIRE, Material.REDSTONE_COMPARATOR_OFF, Material.REDSTONE_COMPARATOR_ON, Material.REDSTONE_LAMP_OFF, Material.REDSTONE_LAMP_ON, Material.REDSTONE_TORCH_OFF, Material.REDSTONE_TORCH_ON, Material.DIODE, Material.DIODE_BLOCK_OFF, Material.DIODE_BLOCK_ON, Material.DETECTOR_RAIL};
|
||||||
|
private static final byte[] PLACED_LOG_DATA_VALUES = {12,13,14,15};
|
||||||
private ClansManager _clansManager;
|
private ClansManager _clansManager;
|
||||||
private BlockRestore _blockRestore;
|
private BlockRestore _blockRestore;
|
||||||
private DamageManager _damageManager;
|
private DamageManager _damageManager;
|
||||||
@ -192,7 +194,7 @@ public class Gameplay extends MiniPlugin
|
|||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void ObsidianCancel(BlockPlaceEvent event)
|
public void ObsidianCancel(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
if (event.getBlock().getType() == Material.OBSIDIAN)
|
if (event.getBlock().getType() == Material.OBSIDIAN && event.getPlayer().getGameMode() != GameMode.CREATIVE)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.item("Obsidian") + "."));
|
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.item("Obsidian") + "."));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -209,9 +211,33 @@ public class Gameplay extends MiniPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void BarrierCancel(BlockPlaceEvent event)
|
||||||
|
{
|
||||||
|
if (event.getBlock().getType() == Material.BARRIER && event.getPlayer().getGameMode() != GameMode.CREATIVE)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.item("Barrier Blocks") + "."));
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void HopperCancel(BlockPlaceEvent event)
|
||||||
|
{
|
||||||
|
if (event.getBlock().getType() == Material.HOPPER && event.getPlayer().getGameMode() != GameMode.CREATIVE)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.item("Hoppers") + "."));
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void CommandPlace(BlockPlaceEvent event)
|
public void CommandPlace(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
|
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (event.getBlock().getType() == Material.COMMAND || event.getBlock().getType() == Material.NOTE_BLOCK || event.getBlock().getType() == Material.REDSTONE_LAMP_ON)
|
if (event.getBlock().getType() == Material.COMMAND || event.getBlock().getType() == Material.NOTE_BLOCK || event.getBlock().getType() == Material.REDSTONE_LAMP_ON)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.item("Proximity Devices") + "."));
|
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.item("Proximity Devices") + "."));
|
||||||
@ -222,7 +248,7 @@ public class Gameplay extends MiniPlugin
|
|||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void RedstoneCancel(BlockPlaceEvent event)
|
public void RedstoneCancel(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
if (Arrays.asList(REDSTONE_TYPES).contains(event.getBlock().getType()))
|
if (Arrays.asList(REDSTONE_TYPES).contains(event.getBlock().getType()) && event.getPlayer().getGameMode() != GameMode.CREATIVE)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place redstone based items."));
|
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place redstone based items."));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -232,6 +258,10 @@ public class Gameplay extends MiniPlugin
|
|||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void MaxHeight(BlockPlaceEvent event)
|
public void MaxHeight(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
|
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (event.getBlock().getLocation().getBlockY() > MAX_BUILD_HEIGHT)
|
if (event.getBlock().getLocation().getBlockY() > MAX_BUILD_HEIGHT)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place blocks this high."));
|
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place blocks this high."));
|
||||||
@ -243,7 +273,7 @@ public class Gameplay extends MiniPlugin
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getBlock().getLocation().getBlockY() < MIN_CHEST_HEIGHT && (event.getBlock().getType() == Material.CHEST || event.getBlock().getType() == Material.TRAPPED_CHEST))
|
if (event.getBlock().getLocation().getBlockY() < MIN_CHEST_HEIGHT && (event.getBlock().getType() == Material.CHEST || event.getBlock().getType() == Material.TRAPPED_CHEST || event.getBlock().getType() == Material.DISPENSER || event.getBlock().getType() == Material.DROPPER || event.getBlock().getType() == Material.FURNACE || event.getBlock().getType() == Material.BURNING_FURNACE))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -594,6 +624,43 @@ public class Gameplay extends MiniPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
public void onLogPlace(BlockPlaceEvent event)
|
||||||
|
{
|
||||||
|
if (UtilItem.isLog(event.getBlock().getType()))
|
||||||
|
{
|
||||||
|
byte data = event.getBlock().getData();
|
||||||
|
final byte newData;
|
||||||
|
if (data % 4 == 0)
|
||||||
|
{
|
||||||
|
newData = 12;
|
||||||
|
}
|
||||||
|
else if ((data - 1) % 4 == 0)
|
||||||
|
{
|
||||||
|
newData = 13;
|
||||||
|
}
|
||||||
|
else if ((data - 2) % 4 == 0)
|
||||||
|
{
|
||||||
|
newData = 14;
|
||||||
|
}
|
||||||
|
else if ((data - 3) % 4 == 0)
|
||||||
|
{
|
||||||
|
newData = 15;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newData = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
UtilServer.runSyncLater(() ->
|
||||||
|
{
|
||||||
|
event.getBlock().setData(newData);
|
||||||
|
}, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void replantTree(BlockBreakEvent event)
|
public void replantTree(BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
@ -626,8 +693,17 @@ public class Gameplay extends MiniPlugin
|
|||||||
|
|
||||||
final byte data = block.getData();
|
final byte data = block.getData();
|
||||||
|
|
||||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), () ->
|
if (ArrayUtils.contains(PLACED_LOG_DATA_VALUES, data))
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UtilServer.runSyncLater(() ->
|
||||||
|
{
|
||||||
|
if (block.getType() != Material.AIR)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
Material mat = block.getRelative(BlockFace.DOWN).getType();
|
Material mat = block.getRelative(BlockFace.DOWN).getType();
|
||||||
if (mat == Material.DIRT || mat == Material.GRASS)
|
if (mat == Material.DIRT || mat == Material.GRASS)
|
||||||
{
|
{
|
||||||
|
@ -8,13 +8,11 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilInv;
|
import mineplex.core.common.util.UtilInv;
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.game.clans.items.attributes.AttributeContainer;
|
import mineplex.game.clans.items.attributes.AttributeContainer;
|
||||||
import mineplex.game.clans.items.attributes.ItemAttribute;
|
import mineplex.game.clans.items.attributes.ItemAttribute;
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
@ -23,7 +21,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
|||||||
* Represents a customizable wrapper for an {@link ItemStack}, enabling the
|
* Represents a customizable wrapper for an {@link ItemStack}, enabling the
|
||||||
* possession of special abilities, attributes, and triggers on item.
|
* possession of special abilities, attributes, and triggers on item.
|
||||||
*/
|
*/
|
||||||
public class CustomItem implements Listener
|
public class CustomItem
|
||||||
{
|
{
|
||||||
// Chat color used for item display name
|
// Chat color used for item display name
|
||||||
private static final ChatColor TITLE_COLOR = ChatColor.GOLD;
|
private static final ChatColor TITLE_COLOR = ChatColor.GOLD;
|
||||||
@ -56,7 +54,6 @@ public class CustomItem implements Listener
|
|||||||
_material = material;
|
_material = material;
|
||||||
_attributes = new AttributeContainer();
|
_attributes = new AttributeContainer();
|
||||||
_uuid = UUID.randomUUID().toString();
|
_uuid = UUID.randomUUID().toString();
|
||||||
UtilServer.RegisterEvents(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomItem(Material material)
|
public CustomItem(Material material)
|
||||||
|
@ -69,6 +69,7 @@ import mineplex.game.clans.items.legendaries.AlligatorsTooth;
|
|||||||
import mineplex.game.clans.items.legendaries.DemonicScythe;
|
import mineplex.game.clans.items.legendaries.DemonicScythe;
|
||||||
import mineplex.game.clans.items.legendaries.GiantsBroadsword;
|
import mineplex.game.clans.items.legendaries.GiantsBroadsword;
|
||||||
import mineplex.game.clans.items.legendaries.HyperAxe;
|
import mineplex.game.clans.items.legendaries.HyperAxe;
|
||||||
|
import mineplex.game.clans.items.legendaries.KnightLance;
|
||||||
import mineplex.game.clans.items.legendaries.LegendaryItem;
|
import mineplex.game.clans.items.legendaries.LegendaryItem;
|
||||||
import mineplex.game.clans.items.legendaries.MagneticMaul;
|
import mineplex.game.clans.items.legendaries.MagneticMaul;
|
||||||
import mineplex.game.clans.items.legendaries.MeridianScepter;
|
import mineplex.game.clans.items.legendaries.MeridianScepter;
|
||||||
@ -122,7 +123,8 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
|
|||||||
WindBlade.class,
|
WindBlade.class,
|
||||||
GiantsBroadsword.class,
|
GiantsBroadsword.class,
|
||||||
HyperAxe.class,
|
HyperAxe.class,
|
||||||
MagneticMaul.class
|
MagneticMaul.class,
|
||||||
|
KnightLance.class
|
||||||
);
|
);
|
||||||
|
|
||||||
private static final WeightSet<Class<? extends RareItem>> RARE_WEIGHTS = new WeightSet<>(
|
private static final WeightSet<Class<? extends RareItem>> RARE_WEIGHTS = new WeightSet<>(
|
||||||
@ -193,7 +195,8 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
|
|||||||
Material.RECORD_9,
|
Material.RECORD_9,
|
||||||
Material.RECORD_10,
|
Material.RECORD_10,
|
||||||
Material.RECORD_11,
|
Material.RECORD_11,
|
||||||
Material.RECORD_12
|
Material.RECORD_12,
|
||||||
|
Material.RABBIT_FOOT
|
||||||
);
|
);
|
||||||
|
|
||||||
static
|
static
|
||||||
@ -425,7 +428,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
|
|||||||
public void spawnItem(Location location)
|
public void spawnItem(Location location)
|
||||||
{
|
{
|
||||||
CustomItem item = generateItem();
|
CustomItem item = generateItem();
|
||||||
if (item.getMaterial() == Material.RECORD_4 || item.getMaterial() == Material.GOLD_RECORD || item.getMaterial() == Material.RECORD_3 || item.getMaterial() == Material.RECORD_5 || item.getMaterial() == Material.RECORD_6 || item.getMaterial() == Material.GREEN_RECORD)
|
if (item.getMaterial() == Material.RECORD_4 || item.getMaterial() == Material.GOLD_RECORD || item.getMaterial() == Material.RECORD_3 || item.getMaterial() == Material.RECORD_5 || item.getMaterial() == Material.RECORD_6 || item.getMaterial() == Material.GREEN_RECORD || item.getMaterial() == Material.RECORD_12)
|
||||||
{
|
{
|
||||||
UtilFirework.playFirework(location, Type.BALL, Color.RED, true, false);
|
UtilFirework.playFirework(location, Type.BALL, Color.RED, true, false);
|
||||||
}
|
}
|
||||||
@ -754,7 +757,6 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
|
|||||||
CustomItem item = it.next();
|
CustomItem item = it.next();
|
||||||
if (item._lastUser == null || !item._lastUser.isOnline())
|
if (item._lastUser == null || !item._lastUser.isOnline())
|
||||||
{
|
{
|
||||||
UtilServer.Unregister(item);
|
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package mineplex.game.clans.items;
|
package mineplex.game.clans.items;
|
||||||
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.ItemFrame;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -10,6 +11,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
@ -237,6 +239,22 @@ public class ItemListener implements Listener, Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onUseItemFrame(PlayerInteractEntityEvent event)
|
||||||
|
{
|
||||||
|
if (event.getRightClicked() instanceof ItemFrame)
|
||||||
|
{
|
||||||
|
boolean frameHas = ((ItemFrame)event.getRightClicked()).getItem() != null;
|
||||||
|
boolean playerHas = event.getPlayer().getItemInHand() != null;
|
||||||
|
|
||||||
|
if (frameHas || playerHas)
|
||||||
|
{
|
||||||
|
GearManager.getInstance().runSyncLater(() -> getGear(event.getPlayer()).updateCache(true), 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param player - the player whose gear is to be fetched
|
* @param player - the player whose gear is to be fetched
|
||||||
* @return the {@link PlayerGear} associated with {@code player}.
|
* @return the {@link PlayerGear} associated with {@code player}.
|
||||||
|
@ -21,10 +21,12 @@ public class PlayerGear
|
|||||||
|
|
||||||
private CustomItem _weapon, _helmet, _chestplate, _leggings, _boots;
|
private CustomItem _weapon, _helmet, _chestplate, _leggings, _boots;
|
||||||
private Map<Integer, CustomItem> _inventory = new HashMap<>();
|
private Map<Integer, CustomItem> _inventory = new HashMap<>();
|
||||||
|
private int _lastHeldSlot = 0;
|
||||||
|
|
||||||
public PlayerGear(Player owner)
|
public PlayerGear(Player owner)
|
||||||
{
|
{
|
||||||
_owner = owner;
|
_owner = owner;
|
||||||
|
_lastHeldSlot = owner.getInventory().getHeldItemSlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,7 +67,12 @@ public class PlayerGear
|
|||||||
_inventory.put(i, GearManager.parseItem(getPlayer().getInventory().getItem(i)));
|
_inventory.put(i, GearManager.parseItem(getPlayer().getInventory().getItem(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_weapon = _inventory.get(getPlayer().getInventory().getHeldItemSlot());
|
if (_weapon != null && _weapon instanceof LegendaryItem && _lastHeldSlot != getPlayer().getInventory().getHeldItemSlot())
|
||||||
|
{
|
||||||
|
((LegendaryItem)_weapon).onUnequip(getPlayer());
|
||||||
|
}
|
||||||
|
_lastHeldSlot = getPlayer().getInventory().getHeldItemSlot();
|
||||||
|
_weapon = _inventory.get(_lastHeldSlot);
|
||||||
_helmet = GearManager.parseItem(getPlayer().getInventory().getHelmet());
|
_helmet = GearManager.parseItem(getPlayer().getInventory().getHelmet());
|
||||||
_chestplate = GearManager.parseItem(getPlayer().getInventory().getChestplate());
|
_chestplate = GearManager.parseItem(getPlayer().getInventory().getChestplate());
|
||||||
_leggings = GearManager.parseItem(getPlayer().getInventory().getLeggings());
|
_leggings = GearManager.parseItem(getPlayer().getInventory().getLeggings());
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package mineplex.game.clans.items.attributes;
|
package mineplex.game.clans.items.attributes;
|
||||||
|
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
|
||||||
import mineplex.game.clans.clans.ClansUtility;
|
|
||||||
import mineplex.game.clans.items.generation.ValueDistribution;
|
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.clans.ClansUtility;
|
||||||
|
import mineplex.game.clans.items.CustomItem;
|
||||||
|
import mineplex.game.clans.items.generation.ValueDistribution;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an attribute that can be attached to {@link CustomItem} to augment their abilities
|
* Represents an attribute that can be attached to {@link CustomItem} to augment their abilities
|
||||||
* and special effects on trigger.
|
* and special effects on trigger.
|
||||||
|
@ -15,7 +15,7 @@ public class GoldToken extends CustomItem
|
|||||||
|
|
||||||
public GoldToken(int goldValue)
|
public GoldToken(int goldValue)
|
||||||
{
|
{
|
||||||
super("Gold Token", null, Material.RECORD_12);
|
super("Gold Token", null, Material.RABBIT_FOOT);
|
||||||
|
|
||||||
_goldValue = goldValue;
|
_goldValue = goldValue;
|
||||||
}
|
}
|
||||||
@ -28,7 +28,8 @@ public class GoldToken extends CustomItem
|
|||||||
@Override
|
@Override
|
||||||
public String[] getDescription()
|
public String[] getDescription()
|
||||||
{
|
{
|
||||||
return new String[] {
|
return new String[]
|
||||||
|
{
|
||||||
String.format("A gold token worth %s gold coins.", _goldValue),
|
String.format("A gold token worth %s gold coins.", _goldValue),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package mineplex.game.clans.items.legendaries;
|
package mineplex.game.clans.items.legendaries;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilAction;
|
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -14,23 +13,26 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
|||||||
|
|
||||||
public class AlligatorsTooth extends LegendaryItem
|
public class AlligatorsTooth extends LegendaryItem
|
||||||
{
|
{
|
||||||
private static ValueDistribution BOOST_GEN = generateDistribution(0.8d, 1.4d);
|
private static final ValueDistribution BOOST_GEN = generateDistribution(0.8d, 1.4d);
|
||||||
private static double LAND_DAMAGE_BONUS = 7;
|
private static final double LAND_DAMAGE_BONUS = 7;
|
||||||
private static double WATER_DAMAGE_BONUS = 11;
|
private static final double WATER_DAMAGE_BONUS = 11;
|
||||||
|
|
||||||
private double _swimSpeed;
|
private double _swimSpeed;
|
||||||
private int _soundUpdateCounter;
|
private int _soundUpdateCounter;
|
||||||
|
|
||||||
public AlligatorsTooth()
|
public AlligatorsTooth()
|
||||||
{
|
{
|
||||||
super("Alligators Tooth", new String[] {
|
super("Alligators Tooth", new String[]
|
||||||
|
{
|
||||||
C.cWhite + "This deadly tooth was stolen from",
|
C.cWhite + "This deadly tooth was stolen from",
|
||||||
C.cWhite + "a nest of reptillian beasts long",
|
C.cWhite + "a nest of reptilian beasts long",
|
||||||
C.cWhite + "ago. Legends say that the holder",
|
C.cWhite + "ago. Legends say that the holder",
|
||||||
C.cWhite + "is granted the underwater agility",
|
C.cWhite + "is granted the underwater agility",
|
||||||
C.cWhite + "of an Alligator",
|
C.cWhite + "of an Alligator.",
|
||||||
" ",
|
" ",
|
||||||
C.cYellow + "Right-Click" + C.cWhite + " to use" + C.cGreen + " Swim",
|
C.cWhite + "Deals " + C.cYellow + "8 Damage" + C.cWhite + " with attack on land",
|
||||||
|
C.cWhite + "Deals " + C.cYellow + "12 Damage" + C.cWhite + " with attack in water",
|
||||||
|
C.cYellow + "Right-Click" + C.cWhite + " to use " + C.cGreen + "Gator Stroke",
|
||||||
}, Material.RECORD_4);
|
}, Material.RECORD_4);
|
||||||
|
|
||||||
_swimSpeed = BOOST_GEN.generateValue();
|
_swimSpeed = BOOST_GEN.generateValue();
|
||||||
|
@ -1,12 +1,28 @@
|
|||||||
package mineplex.game.clans.items.legendaries;
|
package mineplex.game.clans.items.legendaries;
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Horse;
|
import org.bukkit.entity.Horse;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Projectile;
|
||||||
|
import org.bukkit.entity.WitherSkull;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.clans.ClansUtility;
|
import mineplex.game.clans.clans.ClansUtility;
|
||||||
@ -14,6 +30,113 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
|||||||
|
|
||||||
public class DemonicScythe extends LegendaryItem
|
public class DemonicScythe extends LegendaryItem
|
||||||
{
|
{
|
||||||
|
private long _interactWait;
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
UtilServer.RegisterEvents(new Listener()
|
||||||
|
{
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void onDamagedByFireball(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
Projectile proj = event.GetProjectile();
|
||||||
|
if (proj != null && UtilEnt.hasFlag(proj, "DemonicScythe.Projectile"))
|
||||||
|
{
|
||||||
|
event.SetCancelled("Unnecessary Scythe Damage");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onHit(ProjectileHitEvent event)
|
||||||
|
{
|
||||||
|
if (event.getEntity() instanceof WitherSkull)
|
||||||
|
{
|
||||||
|
WitherSkull skull = (WitherSkull) event.getEntity();
|
||||||
|
|
||||||
|
if (!UtilEnt.hasFlag(skull, "DemonicScythe.Projectile"))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Location hit = skull.getLocation();
|
||||||
|
boolean inverted = skull.isCharged();
|
||||||
|
skull.remove();
|
||||||
|
if (skull.getShooter() == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Player shooter = (Player) skull.getShooter();
|
||||||
|
|
||||||
|
for (Entity e : skull.getNearbyEntities(3, 3, 3))
|
||||||
|
{
|
||||||
|
if (e instanceof LivingEntity)
|
||||||
|
{
|
||||||
|
LivingEntity entity = (LivingEntity) e;
|
||||||
|
if (UtilEnt.hasFlag(entity, "LegendaryAbility.IgnoreMe"))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (ClansManager.getInstance().getClanUtility().isSafe(entity.getLocation()))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (e instanceof Player)
|
||||||
|
{
|
||||||
|
Player target = (Player) e;
|
||||||
|
if (ClansManager.getInstance().hasTimer(target))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (ClansManager.getInstance().isInClan(shooter) && ClansManager.getInstance().getClan(shooter).isMember(target))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (target.getGameMode() == GameMode.CREATIVE || target.getGameMode() == GameMode.SPECTATOR)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (ClansManager.getInstance().getIncognitoManager().Get(target).Hidden)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (ClansManager.getInstance().isInClan(shooter) && ClansManager.getInstance().getClan(shooter).isAlly(ClansManager.getInstance().getClan(target)))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (target.getEntityId() == shooter.getEntityId())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Damage Event
|
||||||
|
ClansManager.getInstance().getDamageManager().NewDamageEvent(entity, shooter, null,
|
||||||
|
DamageCause.CUSTOM, 8, false, true, false,
|
||||||
|
shooter.getName(), "Wither Skull");
|
||||||
|
|
||||||
|
//Velocity
|
||||||
|
Vector trajectory;
|
||||||
|
if (inverted)
|
||||||
|
{
|
||||||
|
trajectory = UtilAlg.getTrajectory2d(entity.getLocation().toVector(), hit.toVector());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trajectory = UtilAlg.getTrajectory2d(hit.toVector(), entity.getLocation().toVector());
|
||||||
|
}
|
||||||
|
UtilAction.velocity(entity,
|
||||||
|
trajectory,
|
||||||
|
2.6, true, 0, 0.2, 1.4, true);
|
||||||
|
|
||||||
|
//Condition
|
||||||
|
ClansManager.getInstance().getCondition().Factory().Falling("Wither Skull", entity, shooter, 10, false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public DemonicScythe()
|
public DemonicScythe()
|
||||||
{
|
{
|
||||||
super("Scythe of the Fallen Lord", new String[]
|
super("Scythe of the Fallen Lord", new String[]
|
||||||
@ -24,7 +147,10 @@ public class DemonicScythe extends LegendaryItem
|
|||||||
C.cWhite + "imbued it with the remnant powers of a",
|
C.cWhite + "imbued it with the remnant powers of a",
|
||||||
C.cWhite + "dark and powerful foe.",
|
C.cWhite + "dark and powerful foe.",
|
||||||
" ",
|
" ",
|
||||||
C.cYellow + "Attack" + C.cWhite + " to use" + C.cGreen + " Leach Health",
|
C.cWhite + "Deals " + C.cYellow + "8 Damage" + C.cWhite + " with attack",
|
||||||
|
C.cYellow + "Attack" + C.cWhite + " to use " + C.cGreen + "Leach Health",
|
||||||
|
C.cYellow + "Right Click" + C.cWhite + " to use " + C.cGreen + "Skull Launcher",
|
||||||
|
C.cYellow + "Shift-Right Click" + C.cWhite + " to use " + C.cGreen + "Gravity Skull Launcher",
|
||||||
}, Material.RECORD_8);
|
}, Material.RECORD_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,6 +171,39 @@ public class DemonicScythe extends LegendaryItem
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(Player wielder)
|
||||||
|
{
|
||||||
|
if (timeSinceLastBlock() >= 98 || (System.currentTimeMillis() - _interactWait) < 98)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ClansManager.getInstance().hasTimer(wielder))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(wielder, F.main("Clans", "You are not allowed to fire skulls whilst protected from PvP. Run " + F.elem("/pvp") + " to enable PvP!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ClansManager.getInstance().getClanUtility().getClaim(wielder.getLocation()) != null && ClansManager.getInstance().getClanUtility().getClaim(wielder.getLocation()).isSafe(wielder.getLocation()))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(wielder, F.main("Clans", "You are not allowed to fire skulls whilst in a safe zone."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!Recharge.Instance.use(wielder, "Scythe Skull Launcher", 9000, true, false))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
WitherSkull skull = wielder.launchProjectile(WitherSkull.class);
|
||||||
|
UtilEnt.addFlag(skull, "DemonicScythe.Projectile");
|
||||||
|
if (wielder.isSneaking())
|
||||||
|
{
|
||||||
|
skull.setCharged(true);
|
||||||
|
}
|
||||||
|
skull.setBounce(false);
|
||||||
|
skull.setIsIncendiary(false);
|
||||||
|
skull.setYield(0);
|
||||||
|
_interactWait = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttack(CustomDamageEvent event, Player wielder)
|
public void onAttack(CustomDamageEvent event, Player wielder)
|
||||||
{
|
{
|
||||||
@ -75,7 +234,7 @@ public class DemonicScythe extends LegendaryItem
|
|||||||
event.AddMod("Scythe of the Fallen Lord", 7);
|
event.AddMod("Scythe of the Fallen Lord", 7);
|
||||||
if (!(event.GetDamageeEntity() instanceof Horse) && Recharge.Instance.use(wielder, "Demonic Scythe Heal", 500, false, false))
|
if (!(event.GetDamageeEntity() instanceof Horse) && Recharge.Instance.use(wielder, "Demonic Scythe Heal", 500, false, false))
|
||||||
{
|
{
|
||||||
wielder.setHealth(Math.min(wielder.getMaxHealth(), wielder.getHealth() + 2));
|
wielder.setHealth(Math.min(wielder.getMaxHealth(), wielder.getHealth() + 3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -50,9 +50,10 @@ public class EnergyCrossbow extends LegendaryItem
|
|||||||
|
|
||||||
public EnergyCrossbow()
|
public EnergyCrossbow()
|
||||||
{
|
{
|
||||||
super("Energy Crossbow", UtilText.splitLinesToArray(new String[] {
|
super("Energy Crossbow", UtilText.splitLinesToArray(new String[]
|
||||||
C.cWhite + "Legend says "
|
{
|
||||||
+ " ",
|
C.cWhite + "Legend says ",
|
||||||
|
" ",
|
||||||
"#" + C.cYellow + "Right-Click" + C.cWhite + " to fire Crossbow."
|
"#" + C.cYellow + "Right-Click" + C.cWhite + " to fire Crossbow."
|
||||||
}, LineFormat.LORE), Material.RECORD_6);
|
}, LineFormat.LORE), Material.RECORD_6);
|
||||||
}
|
}
|
||||||
@ -73,7 +74,8 @@ public class EnergyCrossbow extends LegendaryItem
|
|||||||
|
|
||||||
private void fire(final Player player)
|
private void fire(final Player player)
|
||||||
{
|
{
|
||||||
UtilServer.RegisterEvents(new Listener() {
|
UtilServer.RegisterEvents(new Listener()
|
||||||
|
{
|
||||||
private Location _lastLoc;
|
private Location _lastLoc;
|
||||||
|
|
||||||
private Arrow _arrow;
|
private Arrow _arrow;
|
||||||
@ -181,7 +183,6 @@ public class EnergyCrossbow extends LegendaryItem
|
|||||||
|
|
||||||
hit();
|
hit();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -19,10 +19,11 @@ public class GiantsBroadsword extends LegendaryItem
|
|||||||
|
|
||||||
public GiantsBroadsword()
|
public GiantsBroadsword()
|
||||||
{
|
{
|
||||||
super("Giants Broadsword", new String[]{
|
super("Giants Broadsword", new String[]
|
||||||
C.cWhite + "Forged in the godly mines of Plagieus",
|
{
|
||||||
|
C.cWhite + "Forged in the godly mines of Plagieus,",
|
||||||
C.cWhite + "this sword has endured thousands of",
|
C.cWhite + "this sword has endured thousands of",
|
||||||
C.cWhite + "wars. It is sure to grant certain",
|
C.cWhite + "wars. It is sure to grant glorious",
|
||||||
C.cWhite + "victory in battle.",
|
C.cWhite + "victory in battle.",
|
||||||
C.cWhite + " ",
|
C.cWhite + " ",
|
||||||
C.cWhite + "Deals " + C.cYellow + "10 Damage" + C.cWhite + " with attack",
|
C.cWhite + "Deals " + C.cYellow + "10 Damage" + C.cWhite + " with attack",
|
||||||
@ -62,6 +63,8 @@ public class GiantsBroadsword extends LegendaryItem
|
|||||||
{
|
{
|
||||||
grantPotionEffect(player, PotionEffectType.SLOW, 40, SLOW_AMPLIFIER);
|
grantPotionEffect(player, PotionEffectType.SLOW, 40, SLOW_AMPLIFIER);
|
||||||
if (Recharge.Instance.use(player, "Giants Broadsword Regen", 250L, false, false, false))
|
if (Recharge.Instance.use(player, "Giants Broadsword Regen", 250L, false, false, false))
|
||||||
|
{
|
||||||
grantPotionEffect(player, PotionEffectType.REGENERATION, 5, REGEN_AMPLIFIER); //Regen
|
grantPotionEffect(player, PotionEffectType.REGENERATION, 5, REGEN_AMPLIFIER); //Regen
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -13,25 +13,26 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
|||||||
public class HyperAxe extends LegendaryItem
|
public class HyperAxe extends LegendaryItem
|
||||||
{
|
{
|
||||||
private static final long ATTACK_RATE_DURATION = 1000 / 10;
|
private static final long ATTACK_RATE_DURATION = 1000 / 10;
|
||||||
private static ValueDistribution AMOUNT_GEN = generateDistribution(0, 3); // [1, 4] speed amount
|
private static final ValueDistribution AMOUNT_GEN = generateDistribution(0, 3); // [1, 4] speed amount
|
||||||
private static ValueDistribution DURATION_GEN = generateDistribution(80, 320); // [4, 16] seconds speed duration
|
private static final ValueDistribution DURATION_GEN = generateDistribution(80, 320); // [4, 16] seconds speed duration
|
||||||
|
|
||||||
private int _speedAmount;
|
private final int _speedAmount;
|
||||||
private int _speedDuration;
|
private final int _speedDuration;
|
||||||
|
|
||||||
private long _lastAttack;
|
private long _lastAttack;
|
||||||
|
|
||||||
public HyperAxe()
|
public HyperAxe()
|
||||||
{
|
{
|
||||||
super("Hyper Axe", new String[] {
|
super("Hyper Axe", new String[]
|
||||||
|
{
|
||||||
C.cWhite + "Of all the weapons known to man,",
|
C.cWhite + "Of all the weapons known to man,",
|
||||||
C.cWhite + "none is more prevalent than the",
|
C.cWhite + "none matches the savagery of the",
|
||||||
C.cWhite + "Hyper Axe. Infused with rabbit's",
|
C.cWhite + "Hyper Axe. Infused with a rabbit's",
|
||||||
C.cWhite + "speed and pigman's ferocity, this",
|
C.cWhite + "speed and a pigman's ferocity, this",
|
||||||
C.cWhite + "blade can rip through any opponent.",
|
C.cWhite + "blade can rip through any opponent.",
|
||||||
C.cWhite + " ",
|
C.cWhite + " ",
|
||||||
C.cWhite + "Hit delay is reduced by " + C.cYellow + "50%",
|
C.cWhite + "Hit delay is reduced by " + C.cYellow + "50%",
|
||||||
C.cWhite + "Deals " + C.cYellow + "3 Damage" + C.cWhite + " with attack",
|
C.cWhite + "Deals " + C.cYellow + "6 Damage" + C.cWhite + " with attack",
|
||||||
C.cYellow + "Right-Click" + C.cWhite + " to use " + C.cGreen + "Dash",
|
C.cYellow + "Right-Click" + C.cWhite + " to use " + C.cGreen + "Dash",
|
||||||
}, Material.RECORD_3);
|
}, Material.RECORD_3);
|
||||||
_speedAmount = AMOUNT_GEN.generateIntValue();
|
_speedAmount = AMOUNT_GEN.generateIntValue();
|
||||||
|
@ -0,0 +1,234 @@
|
|||||||
|
package mineplex.game.clans.items.legendaries;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Horse;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
import mineplex.core.common.util.UtilParticle;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilTextBottom;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
|
public class KnightLance extends LegendaryItem
|
||||||
|
{
|
||||||
|
private static final double CHARGE_VELOCITY = 1.5d;
|
||||||
|
private static final double MAX_BUILDUP_TICKS = 20 * 3;
|
||||||
|
|
||||||
|
private boolean _charging;
|
||||||
|
private double _buildup;
|
||||||
|
|
||||||
|
private transient final Set<LivingEntity> _hit = new HashSet<>(); //Avoid creating a new list every tick
|
||||||
|
|
||||||
|
public KnightLance()
|
||||||
|
{
|
||||||
|
super("Knight's Greatlance", new String[]
|
||||||
|
{
|
||||||
|
C.cWhite + "Relic of a bygone age.",
|
||||||
|
C.cWhite + "Emblazoned with cryptic runes, this",
|
||||||
|
C.cWhite + "Lance bears the marks of its ancient master.",
|
||||||
|
C.cWhite + "You feel him with you always:",
|
||||||
|
C.cWhite + "Heed his warnings and stave off the darkness.",
|
||||||
|
" ",
|
||||||
|
C.cWhite + "Deals " + C.cYellow + "8 Damage" + C.cWhite + " with attack",
|
||||||
|
C.cYellow + "Right-Click" + C.cWhite + " to use " + C.cGreen + "Charge",
|
||||||
|
}, Material.RECORD_12);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(Player wielder)
|
||||||
|
{
|
||||||
|
boolean holding = isHoldingRightClick();
|
||||||
|
|
||||||
|
if (holding && !_charging)
|
||||||
|
{
|
||||||
|
if (canPropel(wielder))
|
||||||
|
{
|
||||||
|
_buildup = 0;
|
||||||
|
_charging = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!holding && _charging)
|
||||||
|
{
|
||||||
|
_charging = false;
|
||||||
|
_buildup = 0;
|
||||||
|
}
|
||||||
|
else if (_charging && !canPropel(wielder))
|
||||||
|
{
|
||||||
|
_charging = false;
|
||||||
|
_buildup = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_charging)
|
||||||
|
{
|
||||||
|
for (Entity near : wielder.getNearbyEntities(0.6, 1, 0.6))
|
||||||
|
{
|
||||||
|
if (near instanceof LivingEntity)
|
||||||
|
{
|
||||||
|
LivingEntity entity = (LivingEntity) near;
|
||||||
|
if (!canHit(wielder, entity))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (entity instanceof Horse)
|
||||||
|
{
|
||||||
|
_hit.add((LivingEntity)((Horse)entity).getPassenger());
|
||||||
|
((Horse)entity).eject();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_hit.add(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!_hit.isEmpty())
|
||||||
|
{
|
||||||
|
_charging = false;
|
||||||
|
double damagePercentage = getBuildup() / MAX_BUILDUP_TICKS;
|
||||||
|
_buildup = 0;
|
||||||
|
|
||||||
|
wielder.getWorld().playSound(wielder.getLocation(), Sound.ZOMBIE_METAL, 1.5f, 0.5f);
|
||||||
|
for (LivingEntity hit : _hit)
|
||||||
|
{
|
||||||
|
//Damage Event
|
||||||
|
ClansManager.getInstance().getDamageManager().NewDamageEvent(hit, wielder, null,
|
||||||
|
DamageCause.CUSTOM, 2 + (10 * damagePercentage), false, true, false,
|
||||||
|
wielder.getName(), "Knight's Greatlance Charge");
|
||||||
|
|
||||||
|
//Velocity
|
||||||
|
UtilAction.velocity(hit,
|
||||||
|
UtilAlg.getTrajectory2d(wielder.getLocation().toVector(), hit.getLocation().toVector()),
|
||||||
|
2.6, true, 0, 0.2, 1.4, true);
|
||||||
|
|
||||||
|
//Condition
|
||||||
|
ClansManager.getInstance().getCondition().Factory().Falling("Knight's Greatlance Charge", hit, wielder, 10, false, true);
|
||||||
|
}
|
||||||
|
_hit.clear();
|
||||||
|
Recharge.Instance.useForce(wielder, "Knight Lance Charge Attack", 5000);
|
||||||
|
Recharge.Instance.recharge(wielder, "Knight Lance Charge CD Inform");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
propelPlayer(wielder);
|
||||||
|
UtilTextBottom.displayProgress(getBuildup() / MAX_BUILDUP_TICKS, wielder);
|
||||||
|
_buildup++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUnequip(Player wielder)
|
||||||
|
{
|
||||||
|
_charging = false;
|
||||||
|
_buildup = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttack(CustomDamageEvent event, Player wielder)
|
||||||
|
{
|
||||||
|
event.AddMod("Knight's Greatlance", 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void propelPlayer(Player player)
|
||||||
|
{
|
||||||
|
Vector direction = player.getLocation().getDirection().normalize();
|
||||||
|
direction.setY(0);
|
||||||
|
direction.multiply(CHARGE_VELOCITY);
|
||||||
|
|
||||||
|
player.setVelocity(direction);
|
||||||
|
|
||||||
|
UtilParticle.PlayParticle(ParticleType.CRIT, player.getLocation(),
|
||||||
|
(float)(Math.random() - 0.5), 0.2f + (float)(Math.random() * 1), (float)(Math.random() - 0.5), 0, 3,
|
||||||
|
ViewDist.LONG, UtilServer.getPlayers());
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canPropel(Player player)
|
||||||
|
{
|
||||||
|
return UtilEnt.isGrounded(player) &&
|
||||||
|
!UtilEnt.isInWater(player) &&
|
||||||
|
player.getVehicle() == null &&
|
||||||
|
!ClansManager.getInstance().getClanUtility().isSafe(player) &&
|
||||||
|
Recharge.Instance.usable(player, "Knight Lance Charge Attack", Recharge.Instance.use(player, "Knight Lance Charge CD Inform", 1500, false, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canHit(Player player, LivingEntity entity)
|
||||||
|
{
|
||||||
|
if (UtilEnt.hasFlag(entity, "LegendaryAbility.IgnoreMe"))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (ClansManager.getInstance().getClanUtility().isSafe(entity.getLocation()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (entity instanceof Horse)
|
||||||
|
{
|
||||||
|
Entity passenger = ((Horse)entity).getPassenger();
|
||||||
|
if (passenger == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (passenger instanceof LivingEntity)
|
||||||
|
{
|
||||||
|
if (!canHit(player, (LivingEntity)passenger))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (entity instanceof Player)
|
||||||
|
{
|
||||||
|
Player target = (Player) entity;
|
||||||
|
if (ClansManager.getInstance().hasTimer(target))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (ClansManager.getInstance().isInClan(player) && ClansManager.getInstance().getClan(player).isMember(target))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (target.getGameMode() == GameMode.CREATIVE || target.getGameMode() == GameMode.SPECTATOR)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (ClansManager.getInstance().getIncognitoManager().Get(target).Hidden)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (ClansManager.getInstance().isInClan(player) && ClansManager.getInstance().getClan(player).isAlly(ClansManager.getInstance().getClan(target)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private double getBuildup()
|
||||||
|
{
|
||||||
|
return UtilMath.clamp(_buildup, 0d, MAX_BUILDUP_TICKS);
|
||||||
|
}
|
||||||
|
}
|
@ -13,7 +13,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
|||||||
|
|
||||||
public class LegendaryItem extends CustomItem
|
public class LegendaryItem extends CustomItem
|
||||||
{
|
{
|
||||||
private static final long BLOCK_COOLDOWN = 200L; // Right clicking activates right click for 200ms
|
private static final long BLOCK_COOLDOWN = 260L; // Right clicking activates right click for 260ms
|
||||||
|
|
||||||
protected long _lastBlock; // Timestamp of last block from wielder
|
protected long _lastBlock; // Timestamp of last block from wielder
|
||||||
|
|
||||||
@ -24,19 +24,25 @@ public class LegendaryItem extends CustomItem
|
|||||||
_lastBlock = 0L;
|
_lastBlock = 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(Player wielder)
|
/*
|
||||||
{
|
* Leave implementation to potential subtypes
|
||||||
// Leave implementation to potential subtypes
|
*/
|
||||||
}
|
public void update(Player wielder) {}
|
||||||
|
|
||||||
public void preUpdate(Player wielder)
|
/*
|
||||||
{
|
* Leave implementation to potential subtypes
|
||||||
}
|
*/
|
||||||
|
public void preUpdate(Player wielder) {}
|
||||||
|
|
||||||
public void onAttack(CustomDamageEvent event, Player wielder)
|
/*
|
||||||
{
|
* Leave implementation to potential subtypes
|
||||||
// Leave implementation to potential subtypes
|
*/
|
||||||
}
|
public void onUnequip(Player wielder) {}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Leave implementation to potential subtypes
|
||||||
|
*/
|
||||||
|
public void onAttack(CustomDamageEvent event, Player wielder) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttack(CustomDamageEvent event)
|
public void onAttack(CustomDamageEvent event)
|
||||||
|
@ -7,11 +7,14 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.LineFormat;
|
import mineplex.core.common.util.LineFormat;
|
||||||
import mineplex.core.common.util.UtilAction;
|
import mineplex.core.common.util.UtilAction;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilParticle;
|
import mineplex.core.common.util.UtilParticle;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
@ -31,10 +34,12 @@ public class MagneticMaul extends LegendaryItem
|
|||||||
|
|
||||||
public MagneticMaul()
|
public MagneticMaul()
|
||||||
{
|
{
|
||||||
super("Magnetic Maul", UtilText.splitLinesToArray(new String[] {
|
super("Magnetic Maul", UtilText.splitLinesToArray(new String[]
|
||||||
C.cWhite + "This brutal weapon allows you to pull your enemies towards you with magnetic force!",
|
{
|
||||||
|
C.cWhite + "For centuries, warlords used this hammer to control their subjects. This brutal weapon allows you to pull your enemies towards you with magnetic force!",
|
||||||
" ",
|
" ",
|
||||||
C.cYellow + "Right-Click" + C.cWhite + " to use Maul."
|
"#" + C.cWhite + "Deals " + C.cYellow + "8 Damage" + C.cWhite + " with attack",
|
||||||
|
"#" + C.cYellow + "Right-Click" + C.cWhite + " to use " + C.cGreen + "Magnetism"
|
||||||
}, LineFormat.LORE), Material.RECORD_5);
|
}, LineFormat.LORE), Material.RECORD_5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +52,11 @@ public class MagneticMaul extends LegendaryItem
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (ClansManager.getInstance().hasTimer(wielder))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(wielder, F.main("Clans", "You are not allowed to use the Magnetic Maul whilst protected from PvP. Run " + F.elem("/pvp") + " to enable PvP!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isHoldingRightClick())
|
if (isHoldingRightClick())
|
||||||
{
|
{
|
||||||
@ -94,6 +104,10 @@ public class MagneticMaul extends LegendaryItem
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (UtilEnt.hasFlag(entity, "LegendaryAbility.IgnoreMe"))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
double otherDistance = player.getLocation().distance(entity.getLocation());
|
double otherDistance = player.getLocation().distance(entity.getLocation());
|
||||||
double otherTargetDistance = target.distance(entity.getLocation());
|
double otherTargetDistance = target.distance(entity.getLocation());
|
||||||
|
@ -22,6 +22,7 @@ import mineplex.core.common.util.RGBData;
|
|||||||
import mineplex.core.common.util.UtilBlock;
|
import mineplex.core.common.util.UtilBlock;
|
||||||
import mineplex.core.common.util.UtilCollections;
|
import mineplex.core.common.util.UtilCollections;
|
||||||
import mineplex.core.common.util.UtilColor;
|
import mineplex.core.common.util.UtilColor;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilParticle;
|
import mineplex.core.common.util.UtilParticle;
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
@ -43,10 +44,11 @@ public class MeridianScepter extends LegendaryItem
|
|||||||
|
|
||||||
public MeridianScepter()
|
public MeridianScepter()
|
||||||
{
|
{
|
||||||
super("Meridian Scepter", UtilText.splitLinesToArray(new String[] {
|
super("Meridian Scepter", UtilText.splitLinesToArray(new String[]
|
||||||
C.cWhite + "Legend says that this scepter was found, and retrieved from the deepest trench in all of Minecraftia. It is said that he who wields this scepter holds the power of Poseidon himself."
|
{
|
||||||
+ " ",
|
C.cWhite + "Legend says that this scepter was retrieved from the deepest trench in all of Minecraftia. It is said that he who wields this scepter holds the power of Poseidon himself.",
|
||||||
"#" + C.cYellow + "Right-Click" + C.cWhite + " to use Scepter."
|
" ",
|
||||||
|
"#" + C.cYellow + "Right-Click" + C.cWhite + " to use " + C.cGreen + "Meridian Beam"
|
||||||
}, LineFormat.LORE), Material.RECORD_6);
|
}, LineFormat.LORE), Material.RECORD_6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +95,7 @@ public class MeridianScepter extends LegendaryItem
|
|||||||
{
|
{
|
||||||
for (Entity cur : projectile.getWorld().getEntities())
|
for (Entity cur : projectile.getWorld().getEntities())
|
||||||
{
|
{
|
||||||
if (cur == shooter || !(cur instanceof LivingEntity) || (cur instanceof Player && UtilPlayer.isSpectator(cur)))
|
if (cur == shooter || !(cur instanceof LivingEntity) || (cur instanceof Player && UtilPlayer.isSpectator(cur)) || UtilEnt.hasFlag(cur, "LegendaryAbility.IgnoreMe"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LivingEntity ent = (LivingEntity) cur;
|
LivingEntity ent = (LivingEntity) cur;
|
||||||
@ -102,7 +104,8 @@ public class MeridianScepter extends LegendaryItem
|
|||||||
if (ent.getEyeLocation().subtract(0, .3, 0).distance(projectile) <= 2)
|
if (ent.getEyeLocation().subtract(0, .3, 0).distance(projectile) <= 2)
|
||||||
{
|
{
|
||||||
AttackAnimation aa = new AttackAnimation(ent, shooter);
|
AttackAnimation aa = new AttackAnimation(ent, shooter);
|
||||||
int i = UtilServer.getServer().getScheduler().scheduleSyncRepeatingTask(UtilServer.getPlugin(), () -> {
|
int i = UtilServer.getServer().getScheduler().scheduleSyncRepeatingTask(UtilServer.getPlugin(), () ->
|
||||||
|
{
|
||||||
aa.update();
|
aa.update();
|
||||||
}, 0, 1);
|
}, 0, 1);
|
||||||
_animations.put(aa, i);
|
_animations.put(aa, i);
|
||||||
@ -207,7 +210,8 @@ public class MeridianScepter extends LegendaryItem
|
|||||||
for (Entity cur : projectile.getWorld().getEntities())
|
for (Entity cur : projectile.getWorld().getEntities())
|
||||||
{
|
{
|
||||||
if (cur == shooter || !(cur instanceof LivingEntity)
|
if (cur == shooter || !(cur instanceof LivingEntity)
|
||||||
|| (cur instanceof Player && UtilPlayer.isSpectator(cur)))
|
|| (cur instanceof Player && UtilPlayer.isSpectator(cur))
|
||||||
|
|| UtilEnt.hasFlag(cur, "LegendaryAbility.IgnoreMe"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LivingEntity ent = (LivingEntity) cur;
|
LivingEntity ent = (LivingEntity) cur;
|
||||||
|
@ -11,7 +11,8 @@ public class MeteorBow extends LegendaryItem
|
|||||||
|
|
||||||
public MeteorBow()
|
public MeteorBow()
|
||||||
{
|
{
|
||||||
super("Meteor Bow", new String[]{
|
super("Meteor Bow", new String[]
|
||||||
|
{
|
||||||
"Shoot explosive arrows!"
|
"Shoot explosive arrows!"
|
||||||
}, Material.BOW);
|
}, Material.BOW);
|
||||||
_flightTime = 0;
|
_flightTime = 0;
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package mineplex.game.clans.items.legendaries;
|
package mineplex.game.clans.items.legendaries;
|
||||||
|
|
||||||
import mineplex.game.clans.items.GearManager;
|
import java.lang.reflect.Field;
|
||||||
import mineplex.game.clans.items.PlayerGear;
|
|
||||||
import net.minecraft.server.v1_8_R3.PlayerConnection;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -20,12 +20,14 @@ import mineplex.core.common.util.UtilParticle;
|
|||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTextBottom;
|
import mineplex.core.common.util.UtilTextBottom;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import mineplex.game.clans.items.GearManager;
|
||||||
|
import mineplex.game.clans.items.PlayerGear;
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
import net.minecraft.server.v1_8_R3.PlayerConnection;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
public class WindBlade extends LegendaryItem
|
public class WindBlade extends LegendaryItem
|
||||||
{
|
{
|
||||||
@ -42,6 +44,22 @@ public class WindBlade extends LegendaryItem
|
|||||||
{
|
{
|
||||||
throw new RuntimeException("Could not reflectively access field", exception);
|
throw new RuntimeException("Could not reflectively access field", exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UtilServer.RegisterEvents(new Listener()
|
||||||
|
{
|
||||||
|
@EventHandler
|
||||||
|
public void onFall(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetDamageePlayer() != null && event.GetCause() == EntityDamageEvent.DamageCause.FALL)
|
||||||
|
{
|
||||||
|
PlayerGear playerGear = GearManager.getInstance().getPlayerGear(event.GetDamageePlayer());
|
||||||
|
if (playerGear.getWeapon() instanceof WindBlade)
|
||||||
|
{
|
||||||
|
event.SetCancelled("Wind Blade No Fall Damage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final double FLIGHT_VELOCITY = 0.75d;
|
private static final double FLIGHT_VELOCITY = 0.75d;
|
||||||
@ -53,14 +71,16 @@ public class WindBlade extends LegendaryItem
|
|||||||
|
|
||||||
public WindBlade()
|
public WindBlade()
|
||||||
{
|
{
|
||||||
super("Wind Blade", new String[]{
|
super("Wind Blade", new String[]
|
||||||
|
{
|
||||||
C.cWhite + "Long ago, a race of cloud dwellers",
|
C.cWhite + "Long ago, a race of cloud dwellers",
|
||||||
C.cWhite + "terrorized the skies. A remnant of",
|
C.cWhite + "terrorized the skies. A remnant of",
|
||||||
C.cWhite + "their tyranny, this airy blade is",
|
C.cWhite + "their tyranny, this airy blade is",
|
||||||
C.cWhite + "the last surviving memorium from",
|
C.cWhite + "the last surviving memorium from",
|
||||||
C.cWhite + "their final battle against the Titans.",
|
C.cWhite + "their final battle against the Titans.",
|
||||||
" ",
|
" ",
|
||||||
C.cYellow + "Right-Click" + C.cWhite + " to use" + C.cGreen + " Fly",
|
C.cWhite + "Deals " + C.cYellow + "7 Damage" + C.cWhite + " with attack",
|
||||||
|
C.cYellow + "Right-Click" + C.cWhite + " to use " + C.cGreen + "Flight",
|
||||||
}, Material.GREEN_RECORD);
|
}, Material.GREEN_RECORD);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,19 +170,6 @@ public class WindBlade extends LegendaryItem
|
|||||||
event.AddMod("Wind Blade", 6);
|
event.AddMod("Wind Blade", 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onFall(CustomDamageEvent event)
|
|
||||||
{
|
|
||||||
if (event.GetDamageePlayer() != null && event.GetCause() == EntityDamageEvent.DamageCause.FALL)
|
|
||||||
{
|
|
||||||
PlayerGear playerGear = GearManager.getInstance().getPlayerGear(event.GetDamageePlayer());
|
|
||||||
if (playerGear.getWeapon() instanceof WindBlade)
|
|
||||||
{
|
|
||||||
event.SetCancelled("Wind Blade No Fall Damage");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void propelPlayer(Player player)
|
private void propelPlayer(Player player)
|
||||||
{
|
{
|
||||||
Vector direction = player.getLocation().getDirection().normalize();
|
Vector direction = player.getLocation().getDirection().normalize();
|
||||||
|
@ -17,6 +17,7 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.LineFormat;
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilEvent;
|
import mineplex.core.common.util.UtilEvent;
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
@ -122,6 +123,12 @@ public class RunedPickaxe extends RareItem
|
|||||||
if (ClansManager.getInstance().getBlockRestore().contains(event.getBlock()))
|
if (ClansManager.getInstance().getBlockRestore().contains(event.getBlock()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (ClansManager.getInstance().getSiegeManager().getOutpostManager().getOutposts().stream().filter(outpost ->
|
||||||
|
{
|
||||||
|
return UtilAlg.inBoundingBox(event.getBlock().getLocation(), outpost.getBoundsBlockBreak().getLeft(), outpost.getBoundsBlockBreak().getRight());
|
||||||
|
}).findAny().isPresent())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!UtilTime.elapsed(pick._instamineEnabled, 12000))
|
if (!UtilTime.elapsed(pick._instamineEnabled, 12000))
|
||||||
{
|
{
|
||||||
event.getBlock().breakNaturally();
|
event.getBlock().breakNaturally();
|
||||||
|
@ -353,7 +353,7 @@ public class RuneManager implements Listener
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (type == Material.RECORD_4 || type == Material.GOLD_RECORD || type == Material.RECORD_3 || type == Material.RECORD_5 || type == Material.GREEN_RECORD)
|
if (type == Material.RECORD_4 || type == Material.GOLD_RECORD || type == Material.RECORD_3 || type == Material.RECORD_5 || type == Material.GREEN_RECORD || type == Material.RECORD_12)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -44,14 +44,13 @@ import mineplex.game.clans.items.attributes.weapon.JaggedAttribute;
|
|||||||
import mineplex.game.clans.items.attributes.weapon.SharpAttribute;
|
import mineplex.game.clans.items.attributes.weapon.SharpAttribute;
|
||||||
import mineplex.game.clans.items.legendaries.AlligatorsTooth;
|
import mineplex.game.clans.items.legendaries.AlligatorsTooth;
|
||||||
import mineplex.game.clans.items.legendaries.DemonicScythe;
|
import mineplex.game.clans.items.legendaries.DemonicScythe;
|
||||||
import mineplex.game.clans.items.legendaries.EnergyCrossbow;
|
|
||||||
import mineplex.game.clans.items.legendaries.GiantsBroadsword;
|
import mineplex.game.clans.items.legendaries.GiantsBroadsword;
|
||||||
import mineplex.game.clans.items.legendaries.HyperAxe;
|
import mineplex.game.clans.items.legendaries.HyperAxe;
|
||||||
|
import mineplex.game.clans.items.legendaries.KnightLance;
|
||||||
import mineplex.game.clans.items.legendaries.LegendaryItem;
|
import mineplex.game.clans.items.legendaries.LegendaryItem;
|
||||||
import mineplex.game.clans.items.legendaries.MagneticMaul;
|
import mineplex.game.clans.items.legendaries.MagneticMaul;
|
||||||
import mineplex.game.clans.items.legendaries.MeridianScepter;
|
import mineplex.game.clans.items.legendaries.MeridianScepter;
|
||||||
import mineplex.game.clans.items.legendaries.WindBlade;
|
import mineplex.game.clans.items.legendaries.WindBlade;
|
||||||
import mineplex.game.clans.items.rares.Crossbow;
|
|
||||||
import mineplex.game.clans.items.rares.RareItem;
|
import mineplex.game.clans.items.rares.RareItem;
|
||||||
import mineplex.game.clans.items.rares.RunedPickaxe;
|
import mineplex.game.clans.items.rares.RunedPickaxe;
|
||||||
|
|
||||||
@ -106,7 +105,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_legendaryItems = Arrays.<Class<? extends LegendaryItem>> asList(MeridianScepter.class, AlligatorsTooth.class, WindBlade.class, GiantsBroadsword.class, HyperAxe.class, MagneticMaul.class, DemonicScythe.class);
|
_legendaryItems = Arrays.<Class<? extends LegendaryItem>> asList(MeridianScepter.class, AlligatorsTooth.class, WindBlade.class, GiantsBroadsword.class, HyperAxe.class, MagneticMaul.class, DemonicScythe.class, KnightLance.class);
|
||||||
|
|
||||||
_rareItems = Arrays.<Class<? extends RareItem>> asList(RunedPickaxe.class);
|
_rareItems = Arrays.<Class<? extends RareItem>> asList(RunedPickaxe.class);
|
||||||
|
|
||||||
@ -176,7 +175,6 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
{
|
{
|
||||||
stageMaterial = stage3.getRight();
|
stageMaterial = stage3.getRight();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (_stage == 3)
|
else if (_stage == 3)
|
||||||
{
|
{
|
||||||
@ -209,12 +207,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
addButton(4, stageMaterial, 0, stageTitle, new IButton()
|
addButton(4, stageMaterial, 0, stageTitle, (player, clickType) -> {}, false);
|
||||||
{
|
|
||||||
public void onClick(Player player, ClickType clickType)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
addButton(45, Material.REDSTONE_BLOCK, 0, C.cRed + "Previous page", _backButton, false);
|
addButton(45, Material.REDSTONE_BLOCK, 0, C.cRed + "Previous page", _backButton, false);
|
||||||
addButton(53, Material.EMERALD_BLOCK, 0, C.cGreen + "Next page", _nextButton, false);
|
addButton(53, Material.EMERALD_BLOCK, 0, C.cGreen + "Next page", _nextButton, false);
|
||||||
@ -417,7 +410,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
* The only time this code block should be reached is when
|
* The only time this code block should be reached is when
|
||||||
* _itemType is BOW, or if there are ever new item types
|
* _itemType is BOW, or if there are ever new item types
|
||||||
* added which don't have a case, since LEGENDARY is checked
|
* added which don't have a case, since LEGENDARY is checked
|
||||||
* seperately, and ARMOR, and WEAPON have their own cases.
|
* separately, and ARMOR, and WEAPON have their own cases.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_factory.setType(Material.BOW);
|
_factory.setType(Material.BOW);
|
||||||
@ -782,7 +775,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
public void onClick(Player player, ClickType clickType)
|
public void onClick(Player player, ClickType clickType)
|
||||||
{
|
{
|
||||||
player.getInventory().addItem(item);
|
player.getInventory().addItem(item);
|
||||||
|
getPlugin().getPlayerGear(player).updateCache(true);
|
||||||
}
|
}
|
||||||
}, new String[] { C.cWhite + "Click to get item" });
|
}, new String[] { C.cWhite + "Click to get item" });
|
||||||
}
|
}
|
||||||
@ -795,5 +788,4 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
}
|
}
|
||||||
buildPage();
|
buildPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -100,7 +100,7 @@ public class BankPage extends ShopPageBase<ClansManager, BankShop>
|
|||||||
String playerGoldString = ChatColor.RESET + F.value("Your Gold", playerGold + "g");
|
String playerGoldString = ChatColor.RESET + F.value("Your Gold", playerGold + "g");
|
||||||
String purchaseString = ChatColor.RESET + F.value("Token Value", TOKEN_VALUE + "g");
|
String purchaseString = ChatColor.RESET + F.value("Token Value", TOKEN_VALUE + "g");
|
||||||
String goldString = ChatColor.RESET + C.cWhite + "Store your bank gold in the form of a gold token!";
|
String goldString = ChatColor.RESET + C.cWhite + "Store your bank gold in the form of a gold token!";
|
||||||
ShopItem shopItem = new ShopItem(Material.RECORD_12, title, new String[] {" ", playerGoldString, purchaseString, goldString}, 0, true, true);
|
ShopItem shopItem = new ShopItem(Material.RABBIT_FOOT, title, new String[] {" ", playerGoldString, purchaseString, goldString}, 0, true, true);
|
||||||
addButton(3, shopItem, button);
|
addButton(3, shopItem, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ public class BankPage extends ShopPageBase<ClansManager, BankShop>
|
|||||||
String playerGoldString = ChatColor.RESET + F.value("Your Gold", playerGold + "g");
|
String playerGoldString = ChatColor.RESET + F.value("Your Gold", playerGold + "g");
|
||||||
String purchaseString = ChatColor.RESET + C.cWhite + "You don't have enough gold";
|
String purchaseString = ChatColor.RESET + C.cWhite + "You don't have enough gold";
|
||||||
String goldString = ChatColor.RESET + C.cWhite + "You need " + C.cYellow + goldCost + C.cWhite + " gold to purchase a token.";
|
String goldString = ChatColor.RESET + C.cWhite + "You need " + C.cYellow + goldCost + C.cWhite + " gold to purchase a token.";
|
||||||
ShopItem shopItem = new ShopItem(Material.RECORD_12, title, new String[] {" ", playerGoldString, purchaseString, goldString}, 0, true, true);
|
ShopItem shopItem = new ShopItem(Material.RABBIT_FOOT, title, new String[] {" ", playerGoldString, purchaseString, goldString}, 0, true, true);
|
||||||
addButton(3, shopItem, button);
|
addButton(3, shopItem, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,16 +1,11 @@
|
|||||||
package mineplex.game.clans.shop.bank;
|
package mineplex.game.clans.shop.bank;
|
||||||
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.common.util.Callback;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.shop.item.IButton;
|
import mineplex.core.shop.item.IButton;
|
||||||
import mineplex.game.clans.clans.ClanInfo;
|
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
|
||||||
import mineplex.game.clans.economy.GoldManager;
|
import mineplex.game.clans.economy.GoldManager;
|
||||||
import mineplex.game.clans.items.CustomItem;
|
import mineplex.game.clans.items.CustomItem;
|
||||||
import mineplex.game.clans.items.GearManager;
|
import mineplex.game.clans.items.GearManager;
|
||||||
@ -47,5 +42,4 @@ public class CashInButton implements IButton
|
|||||||
_page.refresh();
|
_page.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package mineplex.game.clans.shop.bank;
|
package mineplex.game.clans.shop.bank;
|
||||||
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
|
|
||||||
@ -34,5 +33,4 @@ public class StoreGoldButton implements IButton
|
|||||||
_page.refresh();
|
_page.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -4,8 +4,31 @@ import java.io.IOException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.DyeColor;
|
||||||
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
//import mineplex.game.clans.tutorial.tutorials.clans.repository.TutorialRepository;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.Callback;
|
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilFirework;
|
import mineplex.core.common.util.UtilFirework;
|
||||||
@ -42,30 +65,6 @@ import mineplex.game.clans.tutorial.tutorials.clans.objective.FinalObjective;
|
|||||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.PurchaseItemsObjective;
|
import mineplex.game.clans.tutorial.tutorials.clans.objective.PurchaseItemsObjective;
|
||||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.ShopsObjective;
|
import mineplex.game.clans.tutorial.tutorials.clans.objective.ShopsObjective;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.DyeColor;
|
|
||||||
import org.bukkit.Effect;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
|
||||||
import org.bukkit.event.block.BlockDamageEvent;
|
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
//import mineplex.game.clans.tutorial.tutorials.clans.repository.TutorialRepository;
|
|
||||||
|
|
||||||
public class ClansMainTutorial extends Tutorial
|
public class ClansMainTutorial extends Tutorial
|
||||||
{
|
{
|
||||||
// The distance from which the gate opens when a player approaches.
|
// The distance from which the gate opens when a player approaches.
|
||||||
@ -89,7 +88,7 @@ public class ClansMainTutorial extends Tutorial
|
|||||||
{
|
{
|
||||||
super(plugin, message, hologram, "Clans Tutorial", "main", Material.DIAMOND_SWORD, (byte) 0);
|
super(plugin, message, hologram, "Clans Tutorial", "main", Material.DIAMOND_SWORD, (byte) 0);
|
||||||
|
|
||||||
_fireworks = new ArrayList<Player>();
|
_fireworks = new ArrayList<>();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -121,14 +120,15 @@ public class ClansMainTutorial extends Tutorial
|
|||||||
_fireworks.add(player);
|
_fireworks.add(player);
|
||||||
UtilTextMiddle.display(C.cYellow + "Congratulations", "You have completed the Tutorial!", 10, 60, 10, player);
|
UtilTextMiddle.display(C.cYellow + "Congratulations", "You have completed the Tutorial!", 10, 60, 10, player);
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskLater(getPlugin(), () -> {
|
Bukkit.getScheduler().runTaskLater(getPlugin(), () ->
|
||||||
|
{
|
||||||
_fireworks.remove(player);
|
_fireworks.remove(player);
|
||||||
getMessage().removePlayer(player);
|
getMessage().removePlayer(player);
|
||||||
|
|
||||||
player.teleport(Spawn.getNorthSpawn());
|
player.teleport(Spawn.getNorthSpawn());
|
||||||
UtilInv.Clear(player);
|
UtilInv.Clear(player);
|
||||||
|
|
||||||
// ClansManager.getInstance().getItemMapManager().setMap(player);
|
ClansManager.getInstance().getItemMapManager().setMap(player);
|
||||||
}, 20 * 10L);
|
}, 20 * 10L);
|
||||||
|
|
||||||
player.setWalkSpeed(0.2F);
|
player.setWalkSpeed(0.2F);
|
||||||
@ -145,14 +145,16 @@ public class ClansMainTutorial extends Tutorial
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ClansManager.getInstance().runAsync(() -> {
|
ClansManager.getInstance().runAsync(() ->
|
||||||
|
{
|
||||||
_repository.SetTimesPlayed(player.getUniqueId(), _repository.GetTimesPlayed(player.getUniqueId()) + 1);
|
_repository.SetTimesPlayed(player.getUniqueId(), _repository.GetTimesPlayed(player.getUniqueId()) + 1);
|
||||||
|
|
||||||
final int times = _repository.GetTimesPlayed(player.getUniqueId());
|
final int times = _repository.GetTimesPlayed(player.getUniqueId());
|
||||||
|
|
||||||
if (_repository.GetTimesPlayed(player.getUniqueId()) == 1)
|
if (_repository.GetTimesPlayed(player.getUniqueId()) == 1)
|
||||||
{
|
{
|
||||||
ClansManager.getInstance().runSync(() -> {
|
ClansManager.getInstance().runSync(() ->
|
||||||
|
{
|
||||||
if (times == 1)
|
if (times == 1)
|
||||||
{
|
{
|
||||||
GoldManager.getInstance().addGold(player, 32000);
|
GoldManager.getInstance().addGold(player, 32000);
|
||||||
|
Loading…
Reference in New Issue
Block a user