Merge branch 'update/clans' into develop
This commit is contained in:
commit
3f0938815d
@ -218,7 +218,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
|||||||
if (GetClientManager().Get(to).GetRank() == Rank.DEVELOPER)
|
if (GetClientManager().Get(to).GetRank() == Rank.DEVELOPER)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(from, C.cPurple + to.getName() + " is often AFK or minimized, due to plugin development.");
|
UtilPlayer.message(from, C.cPurple + to.getName() + " is often AFK or minimized, due to plugin development.");
|
||||||
UtilPlayer.message(from, C.cPurple + "Please be patient if she does not reply instantly.");
|
UtilPlayer.message(from, C.cPurple + "Please be patient if they do not reply instantly.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log
|
// Log
|
||||||
|
@ -767,13 +767,7 @@ public class ClansAdmin
|
|||||||
ClanInfo clientClan = getMimic(caller, true);
|
ClanInfo clientClan = getMimic(caller, true);
|
||||||
|
|
||||||
if (clientClan == null)
|
if (clientClan == null)
|
||||||
return;
|
|
||||||
|
|
||||||
if (clientClan.getClaims() >= clientClan.getClaimsMax())
|
|
||||||
{
|
|
||||||
UtilPlayer.message(caller, F.main("Clans Admin", "Your Clan cannot claim more Territory."));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
String chunk = UtilWorld.chunkToStr(caller.getLocation().getChunk());
|
String chunk = UtilWorld.chunkToStr(caller.getLocation().getChunk());
|
||||||
ClanInfo ownerClan = Clans.getClanUtility().getOwner(caller.getLocation());
|
ClanInfo ownerClan = Clans.getClanUtility().getOwner(caller.getLocation());
|
||||||
@ -788,8 +782,12 @@ public class ClansAdmin
|
|||||||
|
|
||||||
//Task
|
//Task
|
||||||
Clans.getClanDataAccess().claim(clientClan.getName(), chunk, caller.getName(), false);
|
Clans.getClanDataAccess().claim(clientClan.getName(), chunk, caller.getName(), false);
|
||||||
|
|
||||||
//Inform
|
//Inform
|
||||||
|
if (clientClan.getClaims() >= clientClan.getClaimsMax())
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("Clans Admin", "You have claimed for that clan past their normal limit."));
|
||||||
|
}
|
||||||
UtilPlayer.message(caller, F.main("Clans Admin", "You claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + "."));
|
UtilPlayer.message(caller, F.main("Clans Admin", "You claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + "."));
|
||||||
clientClan.inform(caller.getName() + " claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName());
|
clientClan.inform(caller.getName() + " claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName());
|
||||||
}
|
}
|
||||||
|
@ -1192,6 +1192,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
|||||||
_worldEvent.onDisable();
|
_worldEvent.onDisable();
|
||||||
_goldManager.onDisable();
|
_goldManager.onDisable();
|
||||||
_playTracker.onDisable();
|
_playTracker.onDisable();
|
||||||
|
_bannerManager.onDisable();
|
||||||
|
_amplifierManager.onDisable();
|
||||||
|
_netherManager.onDisable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
@ -2,21 +2,6 @@ package mineplex.game.clans.clans.banners;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
|
||||||
import mineplex.core.common.Rank;
|
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
import mineplex.core.common.util.UtilBlock;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.common.util.UtilTime;
|
|
||||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
|
||||||
import mineplex.core.recharge.Recharge;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
import mineplex.game.clans.clans.ClanInfo;
|
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
|
||||||
import mineplex.game.clans.clans.banners.command.BannerCommand;
|
|
||||||
import mineplex.game.clans.core.repository.ClanTerritory;
|
|
||||||
|
|
||||||
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;
|
||||||
@ -25,18 +10,36 @@ import org.bukkit.block.BlockFace;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.event.inventory.CraftItemEvent;
|
||||||
|
import org.bukkit.event.inventory.PrepareItemCraftEvent;
|
||||||
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.BannerMeta;
|
import org.bukkit.inventory.meta.BannerMeta;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import mineplex.core.MiniPlugin;
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilBlock;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import mineplex.game.clans.clans.ClanInfo;
|
||||||
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.clans.banners.command.BannerCommand;
|
||||||
|
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
|
||||||
*/
|
*/
|
||||||
public class BannerManager extends MiniPlugin
|
public class BannerManager extends MiniPlugin
|
||||||
{
|
{
|
||||||
private static final long BANNER_PLACE_DURATION = UtilTime.convert(30, TimeUnit.MINUTES, TimeUnit.MILLISECONDS);
|
|
||||||
public final HashMap<String, ClanBanner> LoadedBanners = new HashMap<>();
|
public final HashMap<String, ClanBanner> LoadedBanners = new HashMap<>();
|
||||||
private final HashMap<Block, Long> _placedBanners = new HashMap<>();
|
private final BlockFace[] _radial = { BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST, BlockFace.NORTH, BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST };
|
||||||
private BannerRepository _repo;
|
private BannerRepository _repo;
|
||||||
|
|
||||||
public BannerManager(JavaPlugin plugin)
|
public BannerManager(JavaPlugin plugin)
|
||||||
@ -48,18 +51,6 @@ public class BannerManager extends MiniPlugin
|
|||||||
addCommand(new BannerCommand(this));
|
addCommand(new BannerCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Resets all placed banners to air
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void disable()
|
|
||||||
{
|
|
||||||
for (Block changed : _placedBanners.keySet())
|
|
||||||
{
|
|
||||||
changed.setType(Material.AIR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks what type of banner unlock a player has
|
* Checks what type of banner unlock a player has
|
||||||
* @param player The player to check
|
* @param player The player to check
|
||||||
@ -127,10 +118,6 @@ public class BannerManager extends MiniPlugin
|
|||||||
*/
|
*/
|
||||||
public void placeBanner(Player placing, ClanBanner banner)
|
public void placeBanner(Player placing, ClanBanner banner)
|
||||||
{
|
{
|
||||||
if (!Recharge.Instance.use(placing, "Place Banner", 30000, true, false))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Block block = placing.getLocation().getBlock();
|
Block block = placing.getLocation().getBlock();
|
||||||
BlockPlaceEvent event = new BlockPlaceEvent(block, block.getState(), block, placing.getItemInHand(), placing, true);
|
BlockPlaceEvent event = new BlockPlaceEvent(block, block.getState(), block, placing.getItemInHand(), placing, true);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
@ -145,12 +132,25 @@ public class BannerManager extends MiniPlugin
|
|||||||
ClansManager.getInstance().getBlockRestore().restore(block);
|
ClansManager.getInstance().getBlockRestore().restore(block);
|
||||||
if (block.getType() == Material.AIR && UtilBlock.fullSolid(block.getRelative(BlockFace.DOWN)))
|
if (block.getType() == Material.AIR && UtilBlock.fullSolid(block.getRelative(BlockFace.DOWN)))
|
||||||
{
|
{
|
||||||
|
if (!Recharge.Instance.use(placing, "Place Banner", 30000, true, false))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
block.setType(Material.STANDING_BANNER);
|
block.setType(Material.STANDING_BANNER);
|
||||||
Banner state = (Banner) block.getState();
|
Banner state = (Banner) block.getState();
|
||||||
state.setBaseColor(banner.getBaseColor());
|
state.setBaseColor(banner.getBaseColor());
|
||||||
state.setPatterns(((BannerMeta)banner.getBanner().getItemMeta()).getPatterns());
|
state.setPatterns(((BannerMeta)banner.getBanner().getItemMeta()).getPatterns());
|
||||||
|
org.bukkit.material.Banner data = (org.bukkit.material.Banner) state.getData();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
data.setFacingDirection(_radial[Math.round(placing.getLocation().getYaw() / 45f) & 0x7]);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
state.setData(data);
|
||||||
state.update();
|
state.update();
|
||||||
_placedBanners.put(block, System.currentTimeMillis());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -163,26 +163,79 @@ public class BannerManager extends MiniPlugin
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBreak(BlockBreakEvent event)
|
public void onBreak(BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
if (_placedBanners.containsKey(event.getBlock()))
|
if (event.getBlock().getType() == Material.STANDING_BANNER || event.getBlock().getType() == Material.WALL_BANNER)
|
||||||
{
|
{
|
||||||
_placedBanners.remove(event.getBlock());
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
event.getBlock().setType(Material.AIR);
|
event.getBlock().setType(Material.AIR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onUpdate(UpdateEvent event)
|
public void onDropBanner(BlockPhysicsEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() == UpdateType.FAST)
|
if (event.getBlock().getType() == Material.STANDING_BANNER || event.getBlock().getType() == Material.WALL_BANNER)
|
||||||
{
|
{
|
||||||
for (Block reset : _placedBanners.keySet())
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onCraftBanner(PrepareItemCraftEvent event)
|
||||||
|
{
|
||||||
|
if (event.getInventory().getResult() == null || event.getInventory().getResult().getType() != Material.BANNER)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.getInventory().setResult(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onCraftBanner(CraftItemEvent event)
|
||||||
|
{
|
||||||
|
if (event.getInventory().getResult() == null || event.getInventory().getResult().getType() != Material.BANNER)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onJoinWithBanner(PlayerJoinEvent event)
|
||||||
|
{
|
||||||
|
if (MinecraftServer.getServer().recentTps[0] < 19)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
runSyncLater(() ->
|
||||||
|
{
|
||||||
|
for (ItemStack item : event.getPlayer().getInventory().getContents())
|
||||||
{
|
{
|
||||||
if (UtilTime.elapsed(_placedBanners.get(reset), BANNER_PLACE_DURATION))
|
if (item != null && item.getType() == Material.BANNER)
|
||||||
{
|
{
|
||||||
reset.setType(Material.AIR);
|
event.getPlayer().getInventory().remove(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPickupBanner(PlayerPickupItemEvent event)
|
||||||
|
{
|
||||||
|
if (event.getItem().getItemStack().getType() == Material.BANNER)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
event.getItem().remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPickupBanner(PlayerDropItemEvent event)
|
||||||
|
{
|
||||||
|
if (event.getItemDrop().getItemStack().getType() == Material.BANNER)
|
||||||
|
{
|
||||||
|
event.getItemDrop().remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -110,17 +110,20 @@ public class InvseeInventory implements Listener
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This should always work
|
// This should always work
|
||||||
_targetPlayer = Bukkit.getOfflinePlayer(_uuid);
|
if (_uuid.equals(event.getPlayer().getUniqueId()))
|
||||||
updateInventory();
|
{
|
||||||
|
_targetPlayer = Bukkit.getOfflinePlayer(_uuid);
|
||||||
|
updateInventory();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void on(InventoryOpenEvent event)
|
public void on(InventoryOpenEvent event)
|
||||||
{
|
{
|
||||||
if (event.getPlayer().getUniqueId().equals(_targetPlayer.getUniqueId()) && !_canOpenInventory)
|
if (event.getPlayer().getUniqueId().equals(_uuid) && !_canOpenInventory)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
Bukkit.getScheduler().runTaskLater(UtilServer.getPlugin(), () -> {event.getPlayer().closeInventory();}, 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +298,7 @@ public class InvseeInventory implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Update the player inventory and invsee inventory.
|
* Update the player inventory and invsee inventory.
|
||||||
*
|
*
|
||||||
* @param targetClick If true, then it means the player being invseen has modified their inventory. Otherwise, it's the admin who has modified something
|
* @param targetClick If true, then it means the player being invseen has modified their inventory. Otherwise, it's the admin who has modified something
|
||||||
|
@ -102,16 +102,6 @@ public class BossNetherPortal implements Listener
|
|||||||
{
|
{
|
||||||
_portalFacing = (byte)0;
|
_portalFacing = (byte)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_closeWarnings.add(UtilTime.convert(5, TimeUnit.MINUTES, TimeUnit.MILLISECONDS));
|
|
||||||
_closeWarnings.add(UtilTime.convert(1, TimeUnit.MINUTES, TimeUnit.MILLISECONDS));
|
|
||||||
_closeWarnings.add(30000L);
|
|
||||||
_closeWarnings.add(10000L);
|
|
||||||
_closeWarnings.add(5000L);
|
|
||||||
_closeWarnings.add(4000L);
|
|
||||||
_closeWarnings.add(3000L);
|
|
||||||
_closeWarnings.add(2000L);
|
|
||||||
_closeWarnings.add(1000L);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInPortal(Block block)
|
private boolean isInPortal(Block block)
|
||||||
@ -177,6 +167,15 @@ public class BossNetherPortal implements Listener
|
|||||||
block.setType(Material.PORTAL);
|
block.setType(Material.PORTAL);
|
||||||
block.setData(_portalFacing);
|
block.setData(_portalFacing);
|
||||||
}
|
}
|
||||||
|
_closeWarnings.add(UtilTime.convert(5, TimeUnit.MINUTES, TimeUnit.MILLISECONDS));
|
||||||
|
_closeWarnings.add(UtilTime.convert(1, TimeUnit.MINUTES, TimeUnit.MILLISECONDS));
|
||||||
|
_closeWarnings.add(30000L);
|
||||||
|
_closeWarnings.add(10000L);
|
||||||
|
_closeWarnings.add(5000L);
|
||||||
|
_closeWarnings.add(4000L);
|
||||||
|
_closeWarnings.add(3000L);
|
||||||
|
_closeWarnings.add(2000L);
|
||||||
|
_closeWarnings.add(1000L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,6 +195,7 @@ public class BossNetherPortal implements Listener
|
|||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
HandlerList.unregisterAll(this);
|
HandlerList.unregisterAll(this);
|
||||||
|
_closeWarnings.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
@ -245,12 +245,14 @@ public class BossNetherPortal implements Listener
|
|||||||
ClansManager.getInstance().getNetherManager().OverworldOrigins.remove((Player)event.getEntity());
|
ClansManager.getInstance().getNetherManager().OverworldOrigins.remove((Player)event.getEntity());
|
||||||
((Player)event.getEntity()).removePotionEffect(PotionEffectType.NIGHT_VISION);
|
((Player)event.getEntity()).removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||||
UtilPlayer.message(event.getEntity(), F.main(ClansManager.getInstance().getNetherManager().getName(), "You have escaped " + F.clansNether("The Nether") + "!"));
|
UtilPlayer.message(event.getEntity(), F.main(ClansManager.getInstance().getNetherManager().getName(), "You have escaped " + F.clansNether("The Nether") + "!"));
|
||||||
|
ClansManager.getInstance().runSyncLater(() ->
|
||||||
|
{
|
||||||
|
ClansManager.getInstance().getCombatManager().Get((Player)event.getEntity()).SetLastCombatEngaged(System.currentTimeMillis());
|
||||||
|
}, 20);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClansManager.getInstance().getNetherManager().InNether.put((Player)event.getEntity(), Expire);
|
ClansManager.getInstance().getNetherManager().InNether.put((Player)event.getEntity(), Expire);
|
||||||
Location from = event.getEntity().getLocation();
|
|
||||||
ClansManager.getInstance().getNetherManager().OverworldOrigins.put((Player)event.getEntity(), from);
|
|
||||||
event.getEntity().teleport(ClansManager.getInstance().getNetherManager().getNetherWorld().getSpawnLocation());
|
event.getEntity().teleport(ClansManager.getInstance().getNetherManager().getNetherWorld().getSpawnLocation());
|
||||||
ClansManager.getInstance().ClanTips.displayTip(TipType.ENTER_NETHER, (Player)event.getEntity());
|
ClansManager.getInstance().ClanTips.displayTip(TipType.ENTER_NETHER, (Player)event.getEntity());
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,32 @@ import java.util.Comparator;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.WorldBorder;
|
||||||
|
import org.bukkit.WorldCreator;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.event.entity.EntityPortalEvent;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.event.player.PlayerPortalEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.common.generator.VoidGenerator;
|
import mineplex.core.common.generator.VoidGenerator;
|
||||||
@ -31,32 +57,6 @@ import mineplex.minecraft.game.core.boss.broodmother.SpiderCreature;
|
|||||||
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
|
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
|
||||||
import mineplex.minecraft.game.core.boss.skeletonking.SkeletonCreature;
|
import mineplex.minecraft.game.core.boss.skeletonking.SkeletonCreature;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.WorldBorder;
|
|
||||||
import org.bukkit.WorldCreator;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.block.Action;
|
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
|
||||||
import org.bukkit.event.entity.EntityPortalEvent;
|
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
import org.bukkit.event.player.PlayerPortalEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manager for all nether features
|
* Manager for all nether features
|
||||||
*/
|
*/
|
||||||
@ -155,7 +155,12 @@ public class NetherManager extends MiniPlugin
|
|||||||
*/
|
*/
|
||||||
public Location getReturnLocation(Player player)
|
public Location getReturnLocation(Player player)
|
||||||
{
|
{
|
||||||
return OverworldOrigins.getOrDefault(player, Spawn.getNorthSpawn());
|
Location defaultLoc = Spawn.getWestTown();
|
||||||
|
if (UtilMath.random.nextDouble() <= .5)
|
||||||
|
{
|
||||||
|
defaultLoc = Spawn.getEastTown();
|
||||||
|
}
|
||||||
|
return OverworldOrigins.getOrDefault(player, defaultLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,16 +104,6 @@ public class NetherPortal implements Listener
|
|||||||
{
|
{
|
||||||
_portalFacing = (byte)0;
|
_portalFacing = (byte)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_closeWarnings.add(UtilTime.convert(5, TimeUnit.MINUTES, TimeUnit.MILLISECONDS));
|
|
||||||
_closeWarnings.add(UtilTime.convert(1, TimeUnit.MINUTES, TimeUnit.MILLISECONDS));
|
|
||||||
_closeWarnings.add(30000L);
|
|
||||||
_closeWarnings.add(10000L);
|
|
||||||
_closeWarnings.add(5000L);
|
|
||||||
_closeWarnings.add(4000L);
|
|
||||||
_closeWarnings.add(3000L);
|
|
||||||
_closeWarnings.add(2000L);
|
|
||||||
_closeWarnings.add(1000L);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInPortal(Block block)
|
private boolean isInPortal(Block block)
|
||||||
@ -188,6 +178,15 @@ public class NetherPortal implements Listener
|
|||||||
block.setType(Material.PORTAL);
|
block.setType(Material.PORTAL);
|
||||||
block.setData(_portalFacing);
|
block.setData(_portalFacing);
|
||||||
}
|
}
|
||||||
|
_closeWarnings.add(UtilTime.convert(5, TimeUnit.MINUTES, TimeUnit.MILLISECONDS));
|
||||||
|
_closeWarnings.add(UtilTime.convert(1, TimeUnit.MINUTES, TimeUnit.MILLISECONDS));
|
||||||
|
_closeWarnings.add(30000L);
|
||||||
|
_closeWarnings.add(10000L);
|
||||||
|
_closeWarnings.add(5000L);
|
||||||
|
_closeWarnings.add(4000L);
|
||||||
|
_closeWarnings.add(3000L);
|
||||||
|
_closeWarnings.add(2000L);
|
||||||
|
_closeWarnings.add(1000L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,6 +206,7 @@ public class NetherPortal implements Listener
|
|||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
HandlerList.unregisterAll(this);
|
HandlerList.unregisterAll(this);
|
||||||
|
_closeWarnings.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
@ -256,12 +256,14 @@ public class NetherPortal implements Listener
|
|||||||
ClansManager.getInstance().getNetherManager().OverworldOrigins.remove((Player)event.getEntity());
|
ClansManager.getInstance().getNetherManager().OverworldOrigins.remove((Player)event.getEntity());
|
||||||
((Player)event.getEntity()).removePotionEffect(PotionEffectType.NIGHT_VISION);
|
((Player)event.getEntity()).removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||||
UtilPlayer.message(event.getEntity(), F.main(ClansManager.getInstance().getNetherManager().getName(), "You have escaped " + F.clansNether("The Nether") + "!"));
|
UtilPlayer.message(event.getEntity(), F.main(ClansManager.getInstance().getNetherManager().getName(), "You have escaped " + F.clansNether("The Nether") + "!"));
|
||||||
|
ClansManager.getInstance().runSyncLater(() ->
|
||||||
|
{
|
||||||
|
ClansManager.getInstance().getCombatManager().Get((Player)event.getEntity()).SetLastCombatEngaged(System.currentTimeMillis());
|
||||||
|
}, 20);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClansManager.getInstance().getNetherManager().InNether.put((Player)event.getEntity(), Expire);
|
ClansManager.getInstance().getNetherManager().InNether.put((Player)event.getEntity(), Expire);
|
||||||
Location from = event.getEntity().getLocation();
|
|
||||||
ClansManager.getInstance().getNetherManager().OverworldOrigins.put((Player)event.getEntity(), from);
|
|
||||||
event.getEntity().teleport(ClansManager.getInstance().getNetherManager().getNetherWorld().getSpawnLocation());
|
event.getEntity().teleport(ClansManager.getInstance().getNetherManager().getNetherWorld().getSpawnLocation());
|
||||||
ClansManager.getInstance().ClanTips.displayTip(TipType.ENTER_NETHER, (Player)event.getEntity());
|
ClansManager.getInstance().ClanTips.displayTip(TipType.ENTER_NETHER, (Player)event.getEntity());
|
||||||
}
|
}
|
||||||
@ -292,7 +294,7 @@ public class NetherPortal implements Listener
|
|||||||
Long warning = -1L;
|
Long warning = -1L;
|
||||||
for (Long test : _closeWarnings)
|
for (Long test : _closeWarnings)
|
||||||
{
|
{
|
||||||
if ((Expire - System.currentTimeMillis()) < warning)
|
if ((Expire - System.currentTimeMillis()) < test)
|
||||||
{
|
{
|
||||||
warning = test;
|
warning = test;
|
||||||
break;
|
break;
|
||||||
|
@ -43,6 +43,10 @@ public class ForceTeleportCommand extends CommandBase<NetherManager>
|
|||||||
Plugin.OverworldOrigins.remove(caller);
|
Plugin.OverworldOrigins.remove(caller);
|
||||||
caller.removePotionEffect(PotionEffectType.NIGHT_VISION);
|
caller.removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||||
UtilPlayer.message(caller, F.main(ClansManager.getInstance().getNetherManager().getName(), "You have escaped " + F.clansNether("The Nether") + "!"));
|
UtilPlayer.message(caller, F.main(ClansManager.getInstance().getNetherManager().getName(), "You have escaped " + F.clansNether("The Nether") + "!"));
|
||||||
|
ClansManager.getInstance().runSyncLater(() ->
|
||||||
|
{
|
||||||
|
ClansManager.getInstance().getCombatManager().Get(caller).SetLastCombatEngaged(System.currentTimeMillis());
|
||||||
|
}, 20);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -54,7 +58,6 @@ public class ForceTeleportCommand extends CommandBase<NetherManager>
|
|||||||
if (natural)
|
if (natural)
|
||||||
{
|
{
|
||||||
Plugin.InNether.put(caller, System.currentTimeMillis() + UtilTime.convert(10, TimeUnit.MINUTES, TimeUnit.MILLISECONDS));
|
Plugin.InNether.put(caller, System.currentTimeMillis() + UtilTime.convert(10, TimeUnit.MINUTES, TimeUnit.MILLISECONDS));
|
||||||
Plugin.OverworldOrigins.put(caller, caller.getLocation());
|
|
||||||
caller.teleport(Plugin.getNetherWorld().getSpawnLocation());
|
caller.teleport(Plugin.getNetherWorld().getSpawnLocation());
|
||||||
ClansManager.getInstance().ClanTips.displayTip(TipType.ENTER_NETHER, caller);
|
ClansManager.getInstance().ClanTips.displayTip(TipType.ENTER_NETHER, caller);
|
||||||
}
|
}
|
||||||
|
@ -398,20 +398,41 @@ public class GoldManager extends MiniDbClientPlugin<GoldData>
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getQuery(int accountId, String uuid, String name) {
|
public String getQuery(int accountId, String uuid, String name)
|
||||||
|
{
|
||||||
return "SELECT gold FROM clansGold WHERE id = '" + accountId + "' AND serverId=" + _serverId + ";";
|
return "SELECT gold FROM clansGold WHERE id = '" + accountId + "' AND serverId=" + _serverId + ";";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException {
|
public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException
|
||||||
|
{
|
||||||
if (resultSet.next())
|
if (resultSet.next())
|
||||||
{
|
{
|
||||||
Get(playerName).setBalance(resultSet.getInt(1));
|
Get(playerName).setBalance(resultSet.getInt(1));
|
||||||
|
|
||||||
|
if (resultSet.getInt(1) < 0)
|
||||||
|
{
|
||||||
|
setGold(new Callback<Boolean>()
|
||||||
|
{
|
||||||
|
public void run(Boolean success)
|
||||||
|
{
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
System.out.println("Fixed negative gold balance for " + playerName + "!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println("Failed to fix negative gold balance for " + playerName + "!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, "", playerName, accountId, 0, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected GoldData addPlayer(String player) {
|
protected GoldData addPlayer(String player)
|
||||||
|
{
|
||||||
return new GoldData();
|
return new GoldData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import mineplex.core.common.util.InventoryUtil;
|
|||||||
import mineplex.core.common.util.UtilItem;
|
import mineplex.core.common.util.UtilItem;
|
||||||
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.recharge.Recharge;
|
||||||
import mineplex.core.shop.item.IButton;
|
import mineplex.core.shop.item.IButton;
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
|
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
|
||||||
@ -57,6 +58,10 @@ public class ShopItemButton<T extends ShopPageBase<?, ?>> implements IButton
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(final Player player, ClickType clickType)
|
public void onClick(final Player player, ClickType clickType)
|
||||||
{
|
{
|
||||||
|
if (!Recharge.Instance.use(player, "Attempt Buy Clans Shop Item", 1500, false, false))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
boolean shiftClick = (clickType == ClickType.SHIFT_LEFT || clickType == ClickType.SHIFT_RIGHT);
|
boolean shiftClick = (clickType == ClickType.SHIFT_LEFT || clickType == ClickType.SHIFT_RIGHT);
|
||||||
|
|
||||||
if (clickType == ClickType.SHIFT_RIGHT || clickType == ClickType.RIGHT)
|
if (clickType == ClickType.SHIFT_RIGHT || clickType == ClickType.RIGHT)
|
||||||
|
@ -170,6 +170,12 @@ public class Blink extends SkillActive
|
|||||||
|
|
||||||
public void Deblink(Player player, int level)
|
public void Deblink(Player player, int level)
|
||||||
{
|
{
|
||||||
|
Location target = _loc.remove(player);
|
||||||
|
if (!player.getWorld().equals(target.getWorld()))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, F.main(GetClassType().name(), "You cannot use " + F.skill("De-Blink") + " between worlds!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill("De-Blink") + "."));
|
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill("De-Blink") + "."));
|
||||||
|
|
||||||
//Smoke Trail
|
//Smoke Trail
|
||||||
@ -177,8 +183,6 @@ public class Blink extends SkillActive
|
|||||||
|
|
||||||
double curRange = 0;
|
double curRange = 0;
|
||||||
|
|
||||||
Location target = _loc.remove(player);
|
|
||||||
|
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
while (!done)
|
while (!done)
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,7 @@ import mineplex.core.common.util.UtilServer;
|
|||||||
import mineplex.minecraft.game.classcombat.Skill.Mage.events.FissureModifyBlockEvent;
|
import mineplex.minecraft.game.classcombat.Skill.Mage.events.FissureModifyBlockEvent;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
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.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -133,6 +134,10 @@ public class FissureData
|
|||||||
return false;
|
return false;
|
||||||
if (block.getRelative(BlockFace.UP).getType().toString().contains("BANNER"))
|
if (block.getRelative(BlockFace.UP).getType().toString().contains("BANNER"))
|
||||||
return false;
|
return false;
|
||||||
|
if (block.getType() == Material.ANVIL)
|
||||||
|
return false;
|
||||||
|
if (block.getRelative(BlockFace.UP).getType() == Material.ANVIL)
|
||||||
|
return false;
|
||||||
|
|
||||||
Block up = block.getRelative(0, _height + 1, 0);
|
Block up = block.getRelative(0, _height + 1, 0);
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
|
|||||||
caller.sendMessage(C.cBlue + "Uncle Sam Hat: " + getLockedFreedomStr(playerName, "Uncle Sam Hat"));
|
caller.sendMessage(C.cBlue + "Uncle Sam Hat: " + getLockedFreedomStr(playerName, "Uncle Sam Hat"));
|
||||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||||
caller.sendMessage(C.cBlue + "Clan Banner Usage: " + getLockedFreedomStr(playerName, "Clan Banner Usage"));
|
caller.sendMessage(C.cBlue + "Clan Banner Usage: " + getLockedFreedomStr(playerName, "Clan Banner Usage"));
|
||||||
caller.sendMessage(C.cBlue + "Uncle Sam Morph: " + getLockedFreedomStr(playerName, "Clan Banner Editor"));
|
caller.sendMessage(C.cBlue + "Clan Banner Editor: " + getLockedFreedomStr(playerName, "Clan Banner Editor"));
|
||||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||||
|
|
||||||
_accountBonusLog.remove(client.getAccountId());
|
_accountBonusLog.remove(client.getAccountId());
|
||||||
|
Loading…
Reference in New Issue
Block a user