Merge remote-tracking branch 'origin/clans-beta' into clans-beta
This commit is contained in:
commit
1306137cb2
File diff suppressed because it is too large
Load Diff
@ -41,8 +41,8 @@ public class UtilItem
|
|||||||
_materials.put(Material.IRON_ORE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.ORE, ItemCategory.IRON));
|
_materials.put(Material.IRON_ORE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.ORE, ItemCategory.IRON));
|
||||||
_materials.put(Material.IRON_ORE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.ORE, ItemCategory.IRON));
|
_materials.put(Material.IRON_ORE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.ORE, ItemCategory.IRON));
|
||||||
_materials.put(Material.COAL_ORE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.ORE, ItemCategory.IRON));
|
_materials.put(Material.COAL_ORE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.ORE, ItemCategory.IRON));
|
||||||
_materials.put(Material.LOG, EnumSet.of(ItemCategory.BLOCK, ItemCategory.WOOD));
|
_materials.put(Material.LOG, EnumSet.of(ItemCategory.BLOCK, ItemCategory.WOOD, ItemCategory.LOG));
|
||||||
_materials.put(Material.LEAVES, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
_materials.put(Material.LEAVES, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.LEAVES));
|
||||||
_materials.put(Material.SPONGE, EnumSet.of(ItemCategory.BLOCK));
|
_materials.put(Material.SPONGE, EnumSet.of(ItemCategory.BLOCK));
|
||||||
_materials.put(Material.GLASS, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.GLASS));
|
_materials.put(Material.GLASS, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.GLASS));
|
||||||
_materials.put(Material.LAPIS_ORE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.ORE));
|
_materials.put(Material.LAPIS_ORE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.ORE));
|
||||||
@ -185,8 +185,8 @@ public class UtilItem
|
|||||||
_materials.put(Material.DROPPER, EnumSet.of(ItemCategory.BLOCK, ItemCategory.GUI));
|
_materials.put(Material.DROPPER, EnumSet.of(ItemCategory.BLOCK, ItemCategory.GUI));
|
||||||
_materials.put(Material.STAINED_CLAY, EnumSet.of(ItemCategory.BLOCK));
|
_materials.put(Material.STAINED_CLAY, EnumSet.of(ItemCategory.BLOCK));
|
||||||
_materials.put(Material.STAINED_GLASS_PANE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.GLASS));
|
_materials.put(Material.STAINED_GLASS_PANE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.GLASS));
|
||||||
_materials.put(Material.LEAVES_2, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
_materials.put(Material.LEAVES_2, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.LEAVES));
|
||||||
_materials.put(Material.LOG_2, EnumSet.of(ItemCategory.BLOCK, ItemCategory.WOOD));
|
_materials.put(Material.LOG_2, EnumSet.of(ItemCategory.BLOCK, ItemCategory.WOOD, ItemCategory.LOG));
|
||||||
_materials.put(Material.ACACIA_STAIRS, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
_materials.put(Material.ACACIA_STAIRS, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
||||||
_materials.put(Material.DARK_OAK_STAIRS, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
_materials.put(Material.DARK_OAK_STAIRS, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
||||||
_materials.put(Material.HAY_BLOCK, EnumSet.of(ItemCategory.BLOCK));
|
_materials.put(Material.HAY_BLOCK, EnumSet.of(ItemCategory.BLOCK));
|
||||||
@ -808,6 +808,26 @@ public class UtilItem
|
|||||||
return isItem(stack == null ? null : stack.getType());
|
return isItem(stack == null ? null : stack.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isLog(Material material)
|
||||||
|
{
|
||||||
|
return material == null ? false : (_materials.get(material).contains(ItemCategory.LOG));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isLog(ItemStack stack)
|
||||||
|
{
|
||||||
|
return isLog(stack == null ? null : stack.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isLeaf(Material material)
|
||||||
|
{
|
||||||
|
return material == null ? false : (_materials.get(material).contains(ItemCategory.LEAVES));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isLeaf(ItemStack stack)
|
||||||
|
{
|
||||||
|
return isLeaf(stack == null ? null : stack.getType());
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isTool(Material material)
|
public static boolean isTool(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.TOOL));
|
return material == null ? false : (_materials.get(material).contains(ItemCategory.TOOL));
|
||||||
@ -970,7 +990,9 @@ public class UtilItem
|
|||||||
HOE,
|
HOE,
|
||||||
ITEM,
|
ITEM,
|
||||||
BLOCK,
|
BLOCK,
|
||||||
ITEM_BLOCK;
|
ITEM_BLOCK,
|
||||||
|
LOG,
|
||||||
|
LEAVES;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ArmorMaterial
|
public enum ArmorMaterial
|
||||||
|
@ -17,6 +17,7 @@ public enum UpdateType
|
|||||||
MIN_01(60000),
|
MIN_01(60000),
|
||||||
SLOWEST(32000),
|
SLOWEST(32000),
|
||||||
SLOWER(16000),
|
SLOWER(16000),
|
||||||
|
SEC_08(8000),
|
||||||
SLOW(4000),
|
SLOW(4000),
|
||||||
TWOSEC(2000),
|
TWOSEC(2000),
|
||||||
SEC(1000),
|
SEC(1000),
|
||||||
|
@ -49,65 +49,64 @@ public class Clans extends JavaPlugin
|
|||||||
{
|
{
|
||||||
public static final String VERSION = "0.12";
|
public static final String VERSION = "0.12";
|
||||||
private String WEB_CONFIG = "webServer";
|
private String WEB_CONFIG = "webServer";
|
||||||
|
|
||||||
//Modules
|
// Modules
|
||||||
private CoreClientManager _clientManager;
|
private CoreClientManager _clientManager;
|
||||||
private DonationManager _donationManager;
|
private DonationManager _donationManager;
|
||||||
private ClansManager _clansManager;
|
private ClansManager _clansManager;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
//Configs
|
// Configs
|
||||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
||||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
||||||
saveConfig();
|
saveConfig();
|
||||||
|
|
||||||
String webServerAddress = getConfig().getString(WEB_CONFIG);
|
String webServerAddress = getConfig().getString(WEB_CONFIG);
|
||||||
|
|
||||||
//Logger.initialize(this);
|
// Logger.initialize(this);
|
||||||
|
|
||||||
//Static Modules
|
// Static Modules
|
||||||
CommandCenter.Initialize(this);
|
CommandCenter.Initialize(this);
|
||||||
_clientManager = new CoreClientManager(this, webServerAddress);
|
_clientManager = new CoreClientManager(this, webServerAddress);
|
||||||
CommandCenter.Instance.setClientManager(_clientManager);
|
CommandCenter.Instance.setClientManager(_clientManager);
|
||||||
|
|
||||||
ItemStackFactory.Initialize(this, false);
|
ItemStackFactory.Initialize(this, false);
|
||||||
|
|
||||||
Recharge.Initialize(this);
|
Recharge.Initialize(this);
|
||||||
VisibilityManager.Initialize(this);
|
VisibilityManager.Initialize(this);
|
||||||
// new ProfileCacheManager(this);
|
// new ProfileCacheManager(this);
|
||||||
|
|
||||||
_donationManager = new DonationManager(this, _clientManager, webServerAddress);
|
_donationManager = new DonationManager(this, _clientManager, webServerAddress);
|
||||||
|
|
||||||
new ServerConfiguration(this, _clientManager);
|
new ServerConfiguration(this, _clientManager);
|
||||||
|
|
||||||
PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager);
|
PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager);
|
||||||
|
|
||||||
ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager));
|
ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager));
|
||||||
|
|
||||||
// TODO: Add spawn locations to a configuration file of some sort?
|
// TODO: Add spawn locations to a configuration file of some sort?
|
||||||
new Spawn(this, serverStatusManager.getCurrentServerName());
|
new Spawn(this, serverStatusManager.getCurrentServerName());
|
||||||
Give.Initialize(this);
|
Give.Initialize(this);
|
||||||
|
|
||||||
Teleport teleport = new Teleport(this);
|
Teleport teleport = new Teleport(this);
|
||||||
Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName());
|
Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName());
|
||||||
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
|
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
|
||||||
|
|
||||||
Punish punish = new Punish(this, webServerAddress, _clientManager);
|
Punish punish = new Punish(this, webServerAddress, _clientManager);
|
||||||
AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager);
|
AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager);
|
||||||
AntiHack.Instance.setKick(false);
|
AntiHack.Instance.setKick(false);
|
||||||
|
|
||||||
BlockRestore blockRestore = new BlockRestore(this);
|
BlockRestore blockRestore = new BlockRestore(this);
|
||||||
|
|
||||||
IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal);
|
IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal);
|
||||||
|
|
||||||
StatsManager statsManager = new StatsManager(this, _clientManager);
|
StatsManager statsManager = new StatsManager(this, _clientManager);
|
||||||
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager);
|
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager);
|
||||||
Chat chat = new Chat(this, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
|
Chat chat = new Chat(this, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
|
||||||
new MessageManager(this, _clientManager, preferenceManager, ignoreManager, punish, new FriendManager(this, _clientManager, preferenceManager, portal), chat);
|
new MessageManager(this, _clientManager, preferenceManager, ignoreManager, punish, new FriendManager(this, _clientManager, preferenceManager, portal), chat);
|
||||||
|
|
||||||
new MemoryFix(this);
|
new MemoryFix(this);
|
||||||
new FoodDupeFix(this);
|
new FoodDupeFix(this);
|
||||||
new Explosion(this, blockRestore);
|
new Explosion(this, blockRestore);
|
||||||
@ -117,7 +116,7 @@ public class Clans extends JavaPlugin
|
|||||||
// Enable custom-gear related managers
|
// Enable custom-gear related managers
|
||||||
PacketHandler packetHandler = new PacketHandler(this);
|
PacketHandler packetHandler = new PacketHandler(this);
|
||||||
GearManager customGear = new GearManager(this, packetHandler, _clientManager, _donationManager);
|
GearManager customGear = new GearManager(this, packetHandler, _clientManager, _donationManager);
|
||||||
|
|
||||||
HologramManager hologram = new HologramManager(this);
|
HologramManager hologram = new HologramManager(this);
|
||||||
_clansManager = new ClansManager(this, serverStatusManager.getCurrentServerName(), packetHandler, _clientManager, _donationManager, preferenceManager, blockRestore, teleport, chat, customGear, hologram, webServerAddress);
|
_clansManager = new ClansManager(this, serverStatusManager.getCurrentServerName(), packetHandler, _clientManager, _donationManager, preferenceManager, blockRestore, teleport, chat, customGear, hologram, webServerAddress);
|
||||||
new Recipes(this);
|
new Recipes(this);
|
||||||
@ -135,14 +134,14 @@ public class Clans extends JavaPlugin
|
|||||||
((CraftWorld) world).getHandle().spigotConfig.itemMerge = 0;
|
((CraftWorld) world).getHandle().spigotConfig.itemMerge = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Updates
|
// Updates
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
||||||
|
|
||||||
MinecraftServer.getServer().getPropertyManager().setProperty("debug", true);
|
MinecraftServer.getServer().getPropertyManager().setProperty("debug", true);
|
||||||
|
|
||||||
getServer().setWhitelist(false); // TODO: remove
|
getServer().setWhitelist(false); // TODO: remove
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String prettifyName(Material material)
|
public static String prettifyName(Material material)
|
||||||
{
|
{
|
||||||
String name = "";
|
String name = "";
|
||||||
@ -156,11 +155,12 @@ public class Clans extends JavaPlugin
|
|||||||
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
// Need to notify WorldEventManager of server shutdown, this seemed like the only decent way to do it
|
// Need to notify WorldEventManager of server shutdown, this seemed like
|
||||||
|
// the only decent way to do it
|
||||||
_clansManager.onDisable();
|
_clansManager.onDisable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import mineplex.core.common.util.C;
|
|||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
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.tutorials.types.ClanTips.TipType;
|
||||||
|
|
||||||
public class ClanEnergyTracker extends MiniPlugin
|
public class ClanEnergyTracker extends MiniPlugin
|
||||||
{
|
{
|
||||||
@ -63,7 +64,7 @@ public class ClanEnergyTracker extends MiniPlugin
|
|||||||
if (energyBounds != null && energyRemaining > energyBounds.getLeft() && energyRemaining < energyBounds.getMiddle())
|
if (energyBounds != null && energyRemaining > energyBounds.getLeft() && energyRemaining < energyBounds.getMiddle())
|
||||||
{
|
{
|
||||||
_clans.middleTextClan(clan, energyBounds.getRight()[0], energyBounds.getRight()[1], 20, 200, 80);
|
_clans.middleTextClan(clan, energyBounds.getRight()[0], energyBounds.getRight()[1], 20, 200, 80);
|
||||||
_clans.messageClan(clan, F.main("Energy", "To top up your Clan's Energy, head to the shop and go to the Energy Shop!"));
|
_clans.sendTipToClan(clan, TipType.ENERGY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -721,7 +721,7 @@ public class ClansAdmin
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Task
|
//Task
|
||||||
Clans.getClanDataAccess().home(clan, caller.getLocation(), caller.getName());
|
Clans.getClanDataAccess().setHome(clan, caller.getLocation(), caller.getName());
|
||||||
|
|
||||||
//Inform
|
//Inform
|
||||||
UtilPlayer.message(caller, F.main("Clans Admin", "You set Clan Home to " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
|
UtilPlayer.message(caller, F.main("Clans Admin", "You set Clan Home to " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
|
||||||
|
@ -30,7 +30,7 @@ public class ClansAlphaManager extends MiniPlugin
|
|||||||
private static final int SET_ANNOUNCEMENT = 0;
|
private static final int SET_ANNOUNCEMENT = 0;
|
||||||
|
|
||||||
private static final LinkedList<String> FIRST_JOIN_MESSAGES = new LinkedList<>(ANNOUNCEMENTS.getFirst());
|
private static final LinkedList<String> FIRST_JOIN_MESSAGES = new LinkedList<>(ANNOUNCEMENTS.getFirst());
|
||||||
private static final UpdateType ANNOUNCEMENT_DELAY = UpdateType.MIN_30;
|
private static final UpdateType ANNOUNCEMENT_DELAY = UpdateType.MIN_16;
|
||||||
|
|
||||||
private TaskManager _taskManager;
|
private TaskManager _taskManager;
|
||||||
|
|
||||||
|
@ -591,7 +591,7 @@ public class ClansDataAccessLayer
|
|||||||
return unclaim(chunk, null, sql);
|
return unclaim(chunk, null, sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void home(final ClanInfo clan, Location loc, String player)
|
public void setHome(final ClanInfo clan, Location loc, String player)
|
||||||
{
|
{
|
||||||
// Memory
|
// Memory
|
||||||
clan.setHome(loc);
|
clan.setHome(loc);
|
||||||
|
@ -2,6 +2,7 @@ package mineplex.game.clans.clans;
|
|||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -22,11 +23,13 @@ import org.bukkit.event.block.BlockPistonExtendEvent;
|
|||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.event.player.PlayerFishEvent;
|
import org.bukkit.event.player.PlayerFishEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
@ -38,13 +41,17 @@ 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.UtilGear;
|
import mineplex.core.common.util.UtilGear;
|
||||||
|
import mineplex.core.common.util.UtilInv;
|
||||||
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;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.ClansUtility.ClanRelation;
|
import mineplex.game.clans.clans.ClansUtility.ClanRelation;
|
||||||
import mineplex.game.clans.core.repository.ClanTerritory;
|
import mineplex.game.clans.core.repository.ClanTerritory;
|
||||||
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
import net.minecraft.server.v1_8_R3.EnumDirection;
|
import net.minecraft.server.v1_8_R3.EnumDirection;
|
||||||
|
|
||||||
@ -235,6 +242,11 @@ public class ClansGame extends MiniPlugin
|
|||||||
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You can not break blocks in " + _clans.getClanUtility().getOwnerStringRel(event.getBlock().getLocation(), event.getPlayer()) + "'s Territory." + mimic));
|
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You can not break blocks in " + _clans.getClanUtility().getOwnerStringRel(event.getBlock().getLocation(), event.getPlayer()) + "'s Territory." + mimic));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void respawn(PlayerRespawnEvent event){
|
||||||
|
_clans.getItemMapManager().setMap(event.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void Damage(CustomDamageEvent event)
|
public void Damage(CustomDamageEvent event)
|
||||||
{
|
{
|
||||||
@ -482,10 +494,12 @@ public class ClansGame extends MiniPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void TURTLEZ(PlayerCommandPreprocessEvent event){
|
public void TURTLEZ(PlayerCommandPreprocessEvent event)
|
||||||
if (event.getPlayer().getName().equals("SamitoD") && event.getMessage().equals("/gear")){
|
{
|
||||||
|
if (event.getPlayer().getName().equals("SamitoD") && event.getMessage().equals("/gear"))
|
||||||
|
{
|
||||||
UtilPlayer.message(event.getPlayer(), "UR SPECIAL!!!");
|
UtilPlayer.message(event.getPlayer(), "UR SPECIAL!!!");
|
||||||
_clans.getGearManager().openShop(event.getPlayer());
|
_clans.getGearManager().openShop(event.getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,4 +719,21 @@ public class ClansGame extends MiniPlugin
|
|||||||
UtilPlayer.message(player, F.main("Clans", "Only the Clan Leader and Admins can remove the Clan Home."));
|
UtilPlayer.message(player, F.main("Clans", "Only the Clan Leader and Admins can remove the Clan Home."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onUpdate(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() == UpdateType.FAST)
|
||||||
|
{
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
if (player.getGameMode() == GameMode.CREATIVE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UtilInv.removeAll(player, Material.BED, (byte) 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@ import mineplex.core.blockrestore.BlockRestore;
|
|||||||
import mineplex.core.chat.Chat;
|
import mineplex.core.chat.Chat;
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
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.NautHashMap;
|
import mineplex.core.common.util.NautHashMap;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
@ -68,7 +67,6 @@ 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.loot.LootManager;
|
import mineplex.game.clans.clans.loot.LootManager;
|
||||||
import mineplex.game.clans.clans.map.ItemMapManager;
|
import mineplex.game.clans.clans.map.ItemMapManager;
|
||||||
import mineplex.game.clans.clans.murder.MurderManager;
|
|
||||||
import mineplex.game.clans.clans.observer.ObserverManager;
|
import mineplex.game.clans.clans.observer.ObserverManager;
|
||||||
import mineplex.game.clans.clans.redis.ClanDeleteCommandHandler;
|
import mineplex.game.clans.clans.redis.ClanDeleteCommandHandler;
|
||||||
import mineplex.game.clans.clans.redis.ClanLoadCommandHandler;
|
import mineplex.game.clans.clans.redis.ClanLoadCommandHandler;
|
||||||
@ -91,7 +89,10 @@ import mineplex.game.clans.gameplay.safelog.SafeLog;
|
|||||||
import mineplex.game.clans.gameplay.safelog.npc.NPCManager;
|
import mineplex.game.clans.gameplay.safelog.npc.NPCManager;
|
||||||
import mineplex.game.clans.items.GearManager;
|
import mineplex.game.clans.items.GearManager;
|
||||||
import mineplex.game.clans.spawn.Spawn;
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
|
import mineplex.game.clans.spawn.travel.TravelShop;
|
||||||
import mineplex.game.clans.tutorials.TutorialManager;
|
import mineplex.game.clans.tutorials.TutorialManager;
|
||||||
|
import mineplex.game.clans.tutorials.types.ClanTips;
|
||||||
|
import mineplex.game.clans.tutorials.types.ClanTips.TipType;
|
||||||
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
||||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
|
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
|
||||||
@ -109,16 +110,20 @@ import mineplex.minecraft.game.core.fire.Fire;
|
|||||||
import mineplex.minecraft.game.core.mechanics.Weapon;
|
import mineplex.minecraft.game.core.mechanics.Weapon;
|
||||||
import mineplex.serverdata.commands.ServerCommandManager;
|
import mineplex.serverdata.commands.ServerCommandManager;
|
||||||
|
|
||||||
public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelation
|
public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelation
|
||||||
{
|
{
|
||||||
public static final int CLAIMABLE_RADIUS = 800;
|
public static final int CLAIMABLE_RADIUS = 800;
|
||||||
public static final int WORLD_RADIUS = 1200;
|
public static final int WORLD_RADIUS = 1200;
|
||||||
private static final TimeZone TIME_ZONE = TimeZone.getDefault();
|
private static final TimeZone TIME_ZONE = TimeZone.getDefault();
|
||||||
private static ClansManager _instance;
|
private static ClansManager _instance;
|
||||||
public static ClansManager getInstance() { return _instance; }
|
|
||||||
|
public static ClansManager getInstance()
|
||||||
|
{
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
private String _serverName;
|
private String _serverName;
|
||||||
|
|
||||||
private CoreClientManager _clientManager;
|
private CoreClientManager _clientManager;
|
||||||
private CombatManager _combatManager;
|
private CombatManager _combatManager;
|
||||||
private ClansUtility _clanUtility;
|
private ClansUtility _clanUtility;
|
||||||
@ -136,12 +141,17 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
private HologramManager _hologramManager;
|
private HologramManager _hologramManager;
|
||||||
private GearManager _gearManager;
|
private GearManager _gearManager;
|
||||||
private LootManager _lootManager;
|
private LootManager _lootManager;
|
||||||
|
private DonationManager _donationManager;
|
||||||
|
|
||||||
private TutorialManager _tutorialManager;
|
private TutorialManager _tutorialManager;
|
||||||
|
|
||||||
private ClassManager _classManager;
|
private ClassManager _classManager;
|
||||||
public ClassManager getClassManager() { return _classManager; }
|
|
||||||
|
public ClassManager getClassManager()
|
||||||
|
{
|
||||||
|
return _classManager;
|
||||||
|
}
|
||||||
|
|
||||||
private WarManager _warManager;
|
private WarManager _warManager;
|
||||||
private ProjectileManager _projectileManager;
|
private ProjectileManager _projectileManager;
|
||||||
private WorldEventManager _worldEvent;
|
private WorldEventManager _worldEvent;
|
||||||
@ -151,42 +161,48 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
private NpcManager _npcManager;
|
private NpcManager _npcManager;
|
||||||
private Explosion _explosion;
|
private Explosion _explosion;
|
||||||
private GoldManager _goldManager;
|
private GoldManager _goldManager;
|
||||||
|
|
||||||
private int _inviteExpire = 2;
|
private int _inviteExpire = 2;
|
||||||
private int _nameMin = 3;
|
private int _nameMin = 3;
|
||||||
private int _nameMax = 10;
|
private int _nameMax = 10;
|
||||||
private long _reclaimTime = 1800000;
|
private long _reclaimTime = 1800000;
|
||||||
private long _onlineTime = 1200000;
|
private long _onlineTime = 1200000;
|
||||||
|
|
||||||
// Command Shop
|
// Command Shop
|
||||||
private ClanShop _clanShop;
|
private ClanShop _clanShop;
|
||||||
|
|
||||||
//Clans
|
// Clans
|
||||||
private NautHashMap<String, ClanInfo> _clanMap = new NautHashMap<String, ClanInfo>();
|
private NautHashMap<String, ClanInfo> _clanMap = new NautHashMap<String, ClanInfo>();
|
||||||
// private NautHashMap<String, ClanInfo> _clanMemberNameMap = new NautHashMap<String, ClanInfo>();
|
// private NautHashMap<String, ClanInfo> _clanMemberNameMap = new
|
||||||
|
// NautHashMap<String, ClanInfo>();
|
||||||
private NautHashMap<UUID, ClanInfo> _clanMemberUuidMap = new NautHashMap<UUID, ClanInfo>();
|
private NautHashMap<UUID, ClanInfo> _clanMemberUuidMap = new NautHashMap<UUID, ClanInfo>();
|
||||||
private NautHashMap<String, ClanTerritory> _claimMap = new NautHashMap<String, ClanTerritory>();
|
private NautHashMap<String, ClanTerritory> _claimMap = new NautHashMap<String, ClanTerritory>();
|
||||||
private NautHashMap<String, Long> _unclaimMap = new NautHashMap<String, Long>();
|
private NautHashMap<String, Long> _unclaimMap = new NautHashMap<String, Long>();
|
||||||
|
|
||||||
public String UserDataDir = UtilServer.getServer().getWorlds().get(0).getWorldFolder().getPath() + File.separator + ".." + File.separator + "CLANS_USER_DATA" + File.separator;
|
public String UserDataDir = UtilServer.getServer().getWorlds().get(0).getWorldFolder().getPath() + File.separator + ".." + File.separator + "CLANS_USER_DATA" + File.separator;
|
||||||
|
|
||||||
|
public ClanTips ClanTips;
|
||||||
|
|
||||||
// Spawn area
|
// Spawn area
|
||||||
|
|
||||||
public ClansManager(JavaPlugin plugin, String serverName, PacketHandler packetHandler, CoreClientManager clientManager, DonationManager donationManager, PreferencesManager preferencesManager, BlockRestore blockRestore, Teleport teleport, Chat chat, GearManager gearManager, HologramManager hologramManager, String webServerAddress)
|
public ClansManager(JavaPlugin plugin, String serverName, PacketHandler packetHandler, CoreClientManager clientManager, DonationManager donationManager, PreferencesManager preferencesManager, BlockRestore blockRestore, Teleport teleport, Chat chat, GearManager gearManager, HologramManager hologramManager, String webServerAddress)
|
||||||
{
|
{
|
||||||
super("Clans Manager", plugin);
|
super("Clans Manager", plugin);
|
||||||
|
|
||||||
_instance = this;
|
_instance = this;
|
||||||
|
|
||||||
_serverName = serverName;
|
_serverName = serverName;
|
||||||
_clientManager = clientManager;
|
_clientManager = clientManager;
|
||||||
_combatManager = new CombatManager(plugin);
|
_combatManager = new CombatManager(plugin);
|
||||||
_hologramManager = hologramManager;
|
_hologramManager = hologramManager;
|
||||||
|
|
||||||
_chat = chat;
|
_chat = chat;
|
||||||
_blockRestore = blockRestore;
|
_blockRestore = blockRestore;
|
||||||
_teleport = teleport;
|
_teleport = teleport;
|
||||||
_warManager = new WarManager(plugin, this);
|
_warManager = new WarManager(plugin, this);
|
||||||
|
|
||||||
|
_donationManager = donationManager;
|
||||||
|
|
||||||
_goldManager = new GoldManager(this, _clientManager, donationManager);
|
_goldManager = new GoldManager(this, _clientManager, donationManager);
|
||||||
_gearManager = gearManager;
|
_gearManager = gearManager;
|
||||||
_lootManager = new LootManager(gearManager, _goldManager);
|
_lootManager = new LootManager(gearManager, _goldManager);
|
||||||
@ -201,8 +217,10 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
|
|
||||||
_tutorialManager = new TutorialManager(plugin, _goldManager, taskManager, preferencesManager, this);
|
_tutorialManager = new TutorialManager(plugin, _goldManager, taskManager, preferencesManager, this);
|
||||||
|
|
||||||
|
ClanTips = new ClanTips(plugin, this, preferencesManager);
|
||||||
|
|
||||||
_scoreboard = new ClansScoreboardManager(plugin, _tutorialManager, this, _warManager, _worldEvent, clientManager, donationManager);
|
_scoreboard = new ClansScoreboardManager(plugin, _tutorialManager, this, _warManager, _worldEvent, clientManager, donationManager);
|
||||||
// new MurderManager(plugin, this);
|
// new MurderManager(plugin, this);
|
||||||
|
|
||||||
_clanAdmin = new ClansAdmin(this);
|
_clanAdmin = new ClansAdmin(this);
|
||||||
_clanBlocks = new ClansBlocks();
|
_clanBlocks = new ClansBlocks();
|
||||||
@ -213,19 +231,19 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
_itemMapManager = new ItemMapManager(this, _worldEvent);
|
_itemMapManager = new ItemMapManager(this, _worldEvent);
|
||||||
new TntGeneratorManager(plugin, this);
|
new TntGeneratorManager(plugin, this);
|
||||||
new SupplyDropManager(plugin, this);
|
new SupplyDropManager(plugin, this);
|
||||||
|
|
||||||
_explosion = new Explosion(plugin, blockRestore);
|
_explosion = new Explosion(plugin, blockRestore);
|
||||||
|
|
||||||
// new ClansLoginManager(getPlugin(), clientManager, _serverName);
|
// new ClansLoginManager(getPlugin(), clientManager, _serverName);
|
||||||
|
|
||||||
_clanShop = new ClanShop(this, clientManager, donationManager);
|
_clanShop = new ClanShop(this, clientManager, donationManager);
|
||||||
|
|
||||||
Energy energy = new Energy(plugin);
|
Energy energy = new Energy(plugin);
|
||||||
// TODO: Re-enable customtagfix with NCP update?
|
// TODO: Re-enable customtagfix with NCP update?
|
||||||
//new CustomTagFix(plugin, packetHandler);
|
// new CustomTagFix(plugin, packetHandler);
|
||||||
|
|
||||||
new Field(plugin, creature, _condition, this, energy, serverName);
|
new Field(plugin, creature, _condition, this, energy, serverName);
|
||||||
|
|
||||||
// Required managers to be initialized
|
// Required managers to be initialized
|
||||||
new Spawn(plugin, this);
|
new Spawn(plugin, this);
|
||||||
new NPCManager(this, _hologramManager);
|
new NPCManager(this, _hologramManager);
|
||||||
@ -240,11 +258,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
new Gameplay(plugin, this, blockRestore, damageManager);
|
new Gameplay(plugin, this, blockRestore, damageManager);
|
||||||
_projectileManager = new ProjectileManager(plugin);
|
_projectileManager = new ProjectileManager(plugin);
|
||||||
Fire fire = new Fire(plugin, _condition, damageManager);
|
Fire fire = new Fire(plugin, _condition, damageManager);
|
||||||
|
|
||||||
HashSet<String> itemIgnore = new HashSet<String>();
|
HashSet<String> itemIgnore = new HashSet<String>();
|
||||||
itemIgnore.add("Proximity Explosive");
|
itemIgnore.add("Proximity Explosive");
|
||||||
itemIgnore.add("Proximity Zapper");
|
itemIgnore.add("Proximity Zapper");
|
||||||
|
|
||||||
ItemFactory itemFactory = new ItemFactory(plugin, blockRestore, _condition, damageManager, energy, fire, _projectileManager, webServerAddress, itemIgnore);
|
ItemFactory itemFactory = new ItemFactory(plugin, blockRestore, _condition, damageManager, energy, fire, _projectileManager, webServerAddress, itemIgnore);
|
||||||
SkillFactory skillManager = new SkillFactory(plugin, damageManager, this, _combatManager, _condition, _projectileManager, _disguiseManager, blockRestore, fire, new Movement(plugin), teleport, energy, webServerAddress);
|
SkillFactory skillManager = new SkillFactory(plugin, damageManager, this, _combatManager, _condition, _projectileManager, _disguiseManager, blockRestore, fire, new Movement(plugin), teleport, energy, webServerAddress);
|
||||||
skillManager.RemoveSkill("Dwarf Toss", "Block Toss");
|
skillManager.RemoveSkill("Dwarf Toss", "Block Toss");
|
||||||
@ -257,37 +275,39 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
// Register redis based server commands
|
// Register redis based server commands
|
||||||
ServerCommandManager.getInstance().registerCommandType(ClanDeleteCommand.class, new ClanDeleteCommandHandler());
|
ServerCommandManager.getInstance().registerCommandType(ClanDeleteCommand.class, new ClanDeleteCommandHandler());
|
||||||
ServerCommandManager.getInstance().registerCommandType(ClanLoadCommand.class, new ClanLoadCommandHandler());
|
ServerCommandManager.getInstance().registerCommandType(ClanLoadCommand.class, new ClanLoadCommandHandler());
|
||||||
|
|
||||||
StatsManager statsManager = new StatsManager(plugin, _clientManager);
|
StatsManager statsManager = new StatsManager(plugin, _clientManager);
|
||||||
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager);
|
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager);
|
||||||
ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager);
|
ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager);
|
||||||
_classShop = new ClassCombatShop(shopManager, _clientManager, donationManager, true, "Class Shop");
|
_classShop = new ClassCombatShop(shopManager, _clientManager, donationManager, true, "Class Shop");
|
||||||
|
|
||||||
ClanEnergyManager clanEnergyManager = new ClanEnergyManager(plugin, this, clientManager, donationManager);
|
ClanEnergyManager clanEnergyManager = new ClanEnergyManager(plugin, this, clientManager, donationManager);
|
||||||
|
|
||||||
for (ClanToken token : _clanDataAccess.getRepository().retrieveClans())
|
for (ClanToken token : _clanDataAccess.getRepository().retrieveClans())
|
||||||
{
|
{
|
||||||
loadClan(token);
|
loadClan(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
//RedisDataRepository(ConnectionData writeConn, ConnectionData readConn, Region region, Class<T> elementType, String elementLabel)
|
// RedisDataRepository(ConnectionData writeConn, ConnectionData
|
||||||
// Initialize default region factions and territory (spawn/fields/borderlands)
|
// readConn, Region region, Class<T> elementType, String elementLabel)
|
||||||
|
// Initialize default region factions and territory
|
||||||
|
// (spawn/fields/borderlands)
|
||||||
_clanRegions = new ClansRegions(plugin, this);
|
_clanRegions = new ClansRegions(plugin, this);
|
||||||
_clanRegions.initializeRegions();
|
_clanRegions.initializeRegions();
|
||||||
|
|
||||||
// Disables beds from being crafted
|
// Disables beds from being crafted
|
||||||
Iterator<Recipe> it = _plugin.getServer().recipeIterator();
|
Iterator<Recipe> it = _plugin.getServer().recipeIterator();
|
||||||
Recipe recipe;
|
Recipe recipe;
|
||||||
while(it.hasNext())
|
while (it.hasNext())
|
||||||
{
|
{
|
||||||
recipe = it.next();
|
recipe = it.next();
|
||||||
if (recipe != null && recipe.getResult().getType() == Material.BED)
|
if (recipe != null && recipe.getResult().getType() == Material.BED)
|
||||||
{
|
{
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCommands()
|
public void addCommands()
|
||||||
{
|
{
|
||||||
@ -298,136 +318,140 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
addCommand(new ClanManagementCommand(this));
|
addCommand(new ClanManagementCommand(this));
|
||||||
addCommand(new MapCommand(this));
|
addCommand(new MapCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadClan(ClanToken clanToken)
|
public void loadClan(ClanToken clanToken)
|
||||||
{
|
{
|
||||||
ClanInfo clan = new ClanInfo(this, clanToken);
|
ClanInfo clan = new ClanInfo(this, clanToken);
|
||||||
_clanMap.put(clanToken.Name, clan);
|
_clanMap.put(clanToken.Name, clan);
|
||||||
|
|
||||||
for (ClanMemberToken memberToken : clanToken.Members)
|
for (ClanMemberToken memberToken : clanToken.Members)
|
||||||
{
|
{
|
||||||
_clanMemberUuidMap.put(memberToken.PlayerUUID, clan);
|
_clanMemberUuidMap.put(memberToken.PlayerUUID, clan);
|
||||||
// _clanMemberMap.put(memberToken.Name, clan);
|
// _clanMemberMap.put(memberToken.Name, clan);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ClanTerritoryToken territoryToken : clanToken.Territories)
|
for (ClanTerritoryToken territoryToken : clanToken.Territories)
|
||||||
_claimMap.put(territoryToken.Chunk, new ClanTerritory(territoryToken));
|
_claimMap.put(territoryToken.Chunk, new ClanTerritory(territoryToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
public DisguiseManager getDisguiseManager()
|
public DisguiseManager getDisguiseManager()
|
||||||
{
|
{
|
||||||
return _disguiseManager;
|
return _disguiseManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NpcManager getNPCManager()
|
public NpcManager getNPCManager()
|
||||||
{
|
{
|
||||||
return _npcManager;
|
return _npcManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClansRegions getClanRegions()
|
public ClansRegions getClanRegions()
|
||||||
{
|
{
|
||||||
return _clanRegions;
|
return _clanRegions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DonationManager getDonationManager()
|
||||||
|
{
|
||||||
|
return _donationManager;
|
||||||
|
}
|
||||||
|
|
||||||
public ItemMapManager getItemMapManager()
|
public ItemMapManager getItemMapManager()
|
||||||
{
|
{
|
||||||
return _itemMapManager;
|
return _itemMapManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Explosion getExplosion()
|
public Explosion getExplosion()
|
||||||
{
|
{
|
||||||
return _explosion;
|
return _explosion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInviteExpire()
|
public int getInviteExpire()
|
||||||
{
|
{
|
||||||
return _inviteExpire;
|
return _inviteExpire;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NautHashMap<String, ClanInfo> getClanMap()
|
public NautHashMap<String, ClanInfo> getClanMap()
|
||||||
{
|
{
|
||||||
return _clanMap;
|
return _clanMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getClanNameSet()
|
public Set<String> getClanNameSet()
|
||||||
{
|
{
|
||||||
return _clanMap.keySet();
|
return _clanMap.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public NautHashMap<UUID, ClanInfo> getClanMemberUuidMap()
|
public NautHashMap<UUID, ClanInfo> getClanMemberUuidMap()
|
||||||
{
|
{
|
||||||
return _clanMemberUuidMap;
|
return _clanMemberUuidMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isClaimable(Location location)
|
public static boolean isClaimable(Location location)
|
||||||
{
|
{
|
||||||
int x = Math.abs(location.getBlockX());
|
int x = Math.abs(location.getBlockX());
|
||||||
int z = Math.abs(location.getBlockZ());
|
int z = Math.abs(location.getBlockZ());
|
||||||
|
|
||||||
return (x <= CLAIMABLE_RADIUS && z <= CLAIMABLE_RADIUS)
|
return (x <= CLAIMABLE_RADIUS && z <= CLAIMABLE_RADIUS) && !Spawn.getInstance().isInSpawn(location);
|
||||||
&& !Spawn.getInstance().isInSpawn(location);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFields(Location location)
|
public boolean isFields(Location location)
|
||||||
{
|
{
|
||||||
return getClanUtility().isSpecial(location, "Fields");
|
return getClanUtility().isSpecial(location, "Fields");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUnclaimChunk(ClanInfo stealer, ClanInfo owner)
|
public boolean canUnclaimChunk(ClanInfo stealer, ClanInfo owner)
|
||||||
{
|
{
|
||||||
return owner.getClaims() > owner.getClaimsMax()
|
return owner.getClaims() > owner.getClaimsMax() && !owner.isAdmin() && !owner.isAlly(stealer);
|
||||||
&& !owner.isAdmin() && !owner.isAlly(stealer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClanInfo getClan(Player player)
|
public ClanInfo getClan(Player player)
|
||||||
{
|
{
|
||||||
return _clanMemberUuidMap.get(player.getUniqueId());
|
return _clanMemberUuidMap.get(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInClan(Player player)
|
public boolean isInClan(Player player)
|
||||||
{
|
{
|
||||||
return _clanMemberUuidMap.containsKey(player.getUniqueId());
|
return _clanMemberUuidMap.containsKey(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClanInfo getClan(String clan)
|
public ClanInfo getClan(String clan)
|
||||||
{
|
{
|
||||||
return _clanMap.get(clan);
|
return _clanMap.get(clan);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param clanName
|
* @param clanName
|
||||||
* @return true, if a Clan with matching {@code clanName} exists, false otherwise.
|
* @return true, if a Clan with matching {@code clanName} exists, false
|
||||||
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean clanExists(String clanName)
|
public boolean clanExists(String clanName)
|
||||||
{
|
{
|
||||||
return getClan(clanName) != null;
|
return getClan(clanName) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NautHashMap<String, ClanTerritory> getClaimMap()
|
public NautHashMap<String, ClanTerritory> getClaimMap()
|
||||||
{
|
{
|
||||||
return _claimMap;
|
return _claimMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long lastPower = System.currentTimeMillis();
|
public long lastPower = System.currentTimeMillis();
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void savePlayerActiveBuild(PlayerQuitEvent event)
|
public void savePlayerActiveBuild(PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
if (_classManager.Get(event.getPlayer()) != null && _classManager.Get(event.getPlayer()).GetGameClass() != null)
|
if (_classManager.Get(event.getPlayer()) != null && _classManager.Get(event.getPlayer()).GetGameClass() != null)
|
||||||
{
|
{
|
||||||
CustomBuildToken activeBuild = _classManager.Get(event.getPlayer()).GetActiveCustomBuild(_classManager.Get(event.getPlayer()).GetGameClass());
|
CustomBuildToken activeBuild = _classManager.Get(event.getPlayer()).GetActiveCustomBuild(_classManager.Get(event.getPlayer()).GetGameClass());
|
||||||
|
|
||||||
if (activeBuild == null)
|
if (activeBuild == null) return;
|
||||||
return;
|
|
||||||
|
|
||||||
activeBuild.PlayerName = event.getPlayer().getName();
|
activeBuild.PlayerName = event.getPlayer().getName();
|
||||||
|
|
||||||
// 0 is set aside for active build so we just dupe build to this row whenever we update it.
|
// 0 is set aside for active build so we just dupe build to this row
|
||||||
|
// whenever we update it.
|
||||||
activeBuild.CustomBuildNumber = 0;
|
activeBuild.CustomBuildNumber = 0;
|
||||||
_classManager.GetRepository().SaveCustomBuild(activeBuild);
|
_classManager.GetRepository().SaveCustomBuild(activeBuild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerKick(PlayerKickEvent event)
|
public void onPlayerKick(PlayerKickEvent event)
|
||||||
{
|
{
|
||||||
@ -447,29 +471,27 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)
|
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)
|
||||||
{
|
{
|
||||||
ItemStack item = event.getPlayer().getItemInHand();
|
ItemStack item = event.getPlayer().getItemInHand();
|
||||||
if (item != null && item.getType() == Material.ENDER_PEARL)
|
if (item != null && item.getType() == Material.ENDER_PEARL) event.setCancelled(true);
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void BlockCreatureSpawn(CreatureSpawnCustomEvent event)
|
public void BlockCreatureSpawn(CreatureSpawnCustomEvent event)
|
||||||
{
|
{
|
||||||
ClanInfo clan = _clanUtility.getOwner(event.GetLocation());
|
ClanInfo clan = _clanUtility.getOwner(event.GetLocation());
|
||||||
|
|
||||||
if (clan != null && !clan.isAdmin()
|
if (clan != null && !clan.isAdmin() && !clan.getName().equals("Spawn") && event.getReason() != SpawnReason.CUSTOM)
|
||||||
&& !clan.getName().equals("Spawn") && event.getReason() != SpawnReason.CUSTOM)
|
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void Interact(PlayerInteractEvent event)
|
public void Interact(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
getClanGame().Interact(event);
|
getClanGame().Interact(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void join(PlayerJoinEvent event)
|
public void join(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
@ -480,7 +502,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
clanInfo.playerOnline(player);
|
clanInfo.playerOnline(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void denyBow(EntityShootBowEvent event)
|
public void denyBow(EntityShootBowEvent event)
|
||||||
{
|
{
|
||||||
@ -495,7 +517,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void quit(PlayerQuitEvent event)
|
public void quit(PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
@ -506,32 +528,29 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
clanInfo.playerOffline(player);
|
clanInfo.playerOffline(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void handlePlayerChat(AsyncPlayerChatEvent event)
|
public void handlePlayerChat(AsyncPlayerChatEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled()) return;
|
||||||
return;
|
|
||||||
|
ClientClan client = Get(event.getPlayer());
|
||||||
ClientClan client = Get(event.getPlayer());
|
|
||||||
|
if (client == null) return;
|
||||||
if (client == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ClanInfo clan = _clanUtility.getClanByPlayer(event.getPlayer());
|
ClanInfo clan = _clanUtility.getClanByPlayer(event.getPlayer());
|
||||||
|
|
||||||
if (client.isClanChat() && clan != null)
|
if (client.isClanChat() && clan != null)
|
||||||
{
|
{
|
||||||
event.setFormat(C.cAqua + "%1$s " + C.cDAqua + "%2$s");
|
event.setFormat(C.cAqua + "%1$s " + C.cDAqua + "%2$s");
|
||||||
event.getRecipients().clear();
|
event.getRecipients().clear();
|
||||||
|
|
||||||
for (ClansPlayer cur : clan.getMembers().values())
|
for (ClansPlayer cur : clan.getMembers().values())
|
||||||
{
|
{
|
||||||
Player player = UtilPlayer.searchExact(cur.getUuid());
|
Player player = UtilPlayer.searchExact(cur.getUuid());
|
||||||
|
|
||||||
if (player == null)
|
if (player == null) continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
event.getRecipients().add(player);
|
event.getRecipients().add(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -539,29 +558,27 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
{
|
{
|
||||||
event.setFormat(C.cDGreen + clan.getName() + " " + C.cDGreen + "%1$s " + C.cGreen + "%2$s");
|
event.setFormat(C.cDGreen + clan.getName() + " " + C.cDGreen + "%1$s " + C.cGreen + "%2$s");
|
||||||
event.getRecipients().clear();
|
event.getRecipients().clear();
|
||||||
|
|
||||||
for (ClansPlayer cur : clan.getMembers().values())
|
for (ClansPlayer cur : clan.getMembers().values())
|
||||||
{
|
{
|
||||||
Player player = UtilPlayer.searchExact(cur.getUuid());
|
Player player = UtilPlayer.searchExact(cur.getUuid());
|
||||||
|
|
||||||
if (player == null)
|
if (player == null) continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
event.getRecipients().add(player);
|
event.getRecipients().add(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String allyName : clan.getAllyMap().keySet())
|
for (String allyName : clan.getAllyMap().keySet())
|
||||||
{
|
{
|
||||||
ClanInfo ally = _clanUtility.getClanByClanName(allyName);
|
ClanInfo ally = _clanUtility.getClanByClanName(allyName);
|
||||||
if (ally == null) continue;
|
if (ally == null) continue;
|
||||||
|
|
||||||
for (ClansPlayer cur : ally.getMembers().values())
|
for (ClansPlayer cur : ally.getMembers().values())
|
||||||
{
|
{
|
||||||
Player player = UtilPlayer.searchExact(cur.getUuid());
|
Player player = UtilPlayer.searchExact(cur.getUuid());
|
||||||
|
|
||||||
if (player == null)
|
if (player == null) continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
event.getRecipients().add(player);
|
event.getRecipients().add(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -573,14 +590,14 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
event.setFormat(C.cYellow + "%1$s " + C.cWhite + "%2$s");
|
event.setFormat(C.cYellow + "%1$s " + C.cWhite + "%2$s");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.getRecipients().clear();
|
event.getRecipients().clear();
|
||||||
event.setFormat(C.cGold + clan.getName() + " " + C.cYellow + "%1$s " + C.cWhite + "%2$s");
|
event.setFormat(C.cGold + clan.getName() + " " + C.cYellow + "%1$s " + C.cWhite + "%2$s");
|
||||||
|
|
||||||
for (Player other : UtilServer.getPlayers())
|
for (Player other : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
ClanInfo otherClan = _clanUtility.getClanByPlayer(other);
|
ClanInfo otherClan = _clanUtility.getClanByPlayer(other);
|
||||||
|
|
||||||
if (otherClan == null)
|
if (otherClan == null)
|
||||||
{
|
{
|
||||||
event.getRecipients().add(other);
|
event.getRecipients().add(other);
|
||||||
@ -590,243 +607,255 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
String message = event.getMessage();
|
String message = event.getMessage();
|
||||||
message = _chat.getFilteredMessage(event.getPlayer(), message);
|
message = _chat.getFilteredMessage(event.getPlayer(), message);
|
||||||
ClanRelation rel = _clanUtility.rel(clan, otherClan);
|
ClanRelation rel = _clanUtility.rel(clan, otherClan);
|
||||||
String formatted = rel.getColor(true) + clan.getName() + " " + rel.getColor(false) + event.getPlayer().getName() + " " + C.cWhite + message;
|
String formatted = rel.getColor(true) + clan.getName() + " " + _clientManager.Get(event.getPlayer()).GetRank().getTag(true, false) + " " + rel.getColor(false) + event.getPlayer().getName() + " " + C.cWhite + message;
|
||||||
other.sendMessage(formatted);
|
other.sendMessage(formatted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println((clan == null ? "" : clan.getName()) + " " + _clientManager.Get(event.getPlayer()).GetRank().getTag(true, false) + " " + event.getPlayer().getName() + " " + event.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void messageClan(ClanInfo clan, String message)
|
public void messageClan(ClanInfo clan, String message)
|
||||||
{
|
{
|
||||||
for (Player player : clan.getOnlinePlayers())
|
for (Player player : clan.getOnlinePlayers())
|
||||||
|
{
|
||||||
UtilPlayer.message(player, message);
|
UtilPlayer.message(player, message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendTipToClan(ClanInfo clan, TipType tip)
|
||||||
|
{
|
||||||
|
for (Player player : clan.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
ClanTips.displayTip(tip, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void middleTextClan(ClanInfo clan, String header, String footer)
|
public void middleTextClan(ClanInfo clan, String header, String footer)
|
||||||
{
|
{
|
||||||
middleTextClan(clan, header, footer, 20, 60, 20);
|
middleTextClan(clan, header, footer, 20, 60, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void middleTextClan(ClanInfo clan, String header, String footer, int fadeInTicks, int stayTicks, int fadeOutTicks)
|
public void middleTextClan(ClanInfo clan, String header, String footer, int fadeInTicks, int stayTicks, int fadeOutTicks)
|
||||||
{
|
{
|
||||||
UtilTextMiddle.display(header, footer, fadeInTicks, stayTicks, fadeOutTicks, clan.getOnlinePlayersArray());
|
UtilTextMiddle.display(header, footer, fadeInTicks, stayTicks, fadeOutTicks, clan.getOnlinePlayersArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void chatClan(ClanInfo clan, Player caller, String message)
|
public void chatClan(ClanInfo clan, Player caller, String message)
|
||||||
{
|
{
|
||||||
messageClan(clan, C.cAqua + caller.getName() + " " + C.cDAqua + message);
|
messageClan(clan, C.cAqua + caller.getName() + " " + C.cDAqua + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void chatAlly(ClanInfo clan, Player caller, String message)
|
public void chatAlly(ClanInfo clan, Player caller, String message)
|
||||||
{
|
{
|
||||||
String sendMessage = C.cDGreen + clan.getName() + " " + C.cDGreen + caller.getName() + " " + C.cGreen + message;
|
String sendMessage = C.cDGreen + clan.getName() + " " + C.cDGreen + caller.getName() + " " + C.cGreen + message;
|
||||||
|
|
||||||
messageClan(clan, sendMessage);
|
messageClan(clan, sendMessage);
|
||||||
|
|
||||||
for (String allyName : clan.getAllyMap().keySet())
|
for (String allyName : clan.getAllyMap().keySet())
|
||||||
{
|
{
|
||||||
ClanInfo ally = _clanUtility.getClanByClanName(allyName);
|
ClanInfo ally = _clanUtility.getClanByClanName(allyName);
|
||||||
if (ally == null) continue;
|
if (ally == null) continue;
|
||||||
|
|
||||||
messageClan(ally, sendMessage);
|
messageClan(ally, sendMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNameMin()
|
public int getNameMin()
|
||||||
{
|
{
|
||||||
return _nameMin;
|
return _nameMin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNameMax()
|
public int getNameMax()
|
||||||
{
|
{
|
||||||
return _nameMax;
|
return _nameMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getReclaimTime()
|
public long getReclaimTime()
|
||||||
{
|
{
|
||||||
return _reclaimTime;
|
return _reclaimTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canHurt(Player a, Player b)
|
public boolean canHurt(Player a, Player b)
|
||||||
{
|
{
|
||||||
if (a.equals(b))
|
if (a.equals(b)) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
return _clanUtility.canHurt(a, b);
|
return _clanUtility.canHurt(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canHurt(String a, String b)
|
public boolean canHurt(String a, String b)
|
||||||
{
|
{
|
||||||
if (a.equals(b))
|
if (a.equals(b)) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
return _clanUtility.canHurt(UtilPlayer.searchExact(a), UtilPlayer.searchExact(b));
|
return _clanUtility.canHurt(UtilPlayer.searchExact(a), UtilPlayer.searchExact(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSafe(Player a)
|
public boolean isSafe(Player a)
|
||||||
{
|
{
|
||||||
return _clanUtility.isSafe(a);
|
return _clanUtility.isSafe(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public ClanRelation getRelation(String playerA, String playerB)
|
// public ClanRelation getRelation(String playerA, String playerB)
|
||||||
// {
|
// {
|
||||||
// return getClanUtility().rel(_clanMemberMap.get(playerA), _clanMemberMap.get(playerB));
|
// return getClanUtility().rel(_clanMemberMap.get(playerA),
|
||||||
// }
|
// _clanMemberMap.get(playerB));
|
||||||
|
// }
|
||||||
|
|
||||||
public ClanRelation getRelation(Player playerA, Player playerB)
|
public ClanRelation getRelation(Player playerA, Player playerB)
|
||||||
{
|
{
|
||||||
return getRelation(playerA.getUniqueId(), playerB.getUniqueId());
|
return getRelation(playerA.getUniqueId(), playerB.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClanRelation getRelation(UUID playerA, UUID playerB)
|
public ClanRelation getRelation(UUID playerA, UUID playerB)
|
||||||
{
|
{
|
||||||
return getClanUtility().rel(getClanMemberUuidMap().get(playerA), getClanMemberUuidMap().get(playerB));
|
return getClanUtility().rel(getClanMemberUuidMap().get(playerA), getClanMemberUuidMap().get(playerB));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public long getOnlineTime()
|
public long getOnlineTime()
|
||||||
{
|
{
|
||||||
return _onlineTime;
|
return _onlineTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CombatManager getCombatManager()
|
public CombatManager getCombatManager()
|
||||||
{
|
{
|
||||||
return _combatManager;
|
return _combatManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClansUtility getClanUtility()
|
public ClansUtility getClanUtility()
|
||||||
{
|
{
|
||||||
return _clanUtility;
|
return _clanUtility;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ClientClan AddPlayer(String player)
|
protected ClientClan AddPlayer(String player)
|
||||||
{
|
{
|
||||||
return new ClientClan();
|
return new ClientClan();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockRestore getBlockRestore()
|
public BlockRestore getBlockRestore()
|
||||||
{
|
{
|
||||||
return _blockRestore;
|
return _blockRestore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClansDataAccessLayer getClanDataAccess()
|
public ClansDataAccessLayer getClanDataAccess()
|
||||||
{
|
{
|
||||||
return _clanDataAccess;
|
return _clanDataAccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Teleport getTeleport()
|
public Teleport getTeleport()
|
||||||
{
|
{
|
||||||
return _teleport;
|
return _teleport;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClansDisplay getClanDisplay()
|
public ClansDisplay getClanDisplay()
|
||||||
{
|
{
|
||||||
return _clanDisplay;
|
return _clanDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NautHashMap<String, Long> getUnclaimMap()
|
public NautHashMap<String, Long> getUnclaimMap()
|
||||||
{
|
{
|
||||||
return _unclaimMap;
|
return _unclaimMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClansAdmin getClanAdmin()
|
public ClansAdmin getClanAdmin()
|
||||||
{
|
{
|
||||||
return _clanAdmin;
|
return _clanAdmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClansGame getClanGame()
|
public ClansGame getClanGame()
|
||||||
{
|
{
|
||||||
return _clanGame;
|
return _clanGame;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClansBlocks getClanBlocks()
|
public ClansBlocks getClanBlocks()
|
||||||
{
|
{
|
||||||
return _clanBlocks;
|
return _clanBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getServerName()
|
public String getServerName()
|
||||||
{
|
{
|
||||||
return _serverName;
|
return _serverName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreClientManager getClientManager()
|
public CoreClientManager getClientManager()
|
||||||
{
|
{
|
||||||
return _clientManager;
|
return _clientManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConditionManager getCondition()
|
public ConditionManager getCondition()
|
||||||
{
|
{
|
||||||
return _condition;
|
return _condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassCombatShop getClassShop()
|
public ClassCombatShop getClassShop()
|
||||||
{
|
{
|
||||||
return _classShop;
|
return _classShop;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClanShop getClanShop()
|
public ClanShop getClanShop()
|
||||||
{
|
{
|
||||||
return _clanShop;
|
return _clanShop;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WarManager getWarManager()
|
public WarManager getWarManager()
|
||||||
{
|
{
|
||||||
return _warManager;
|
return _warManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectileManager getProjectile()
|
public ProjectileManager getProjectile()
|
||||||
{
|
{
|
||||||
return _projectileManager;
|
return _projectileManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorldEventManager getWorldEvent()
|
public WorldEventManager getWorldEvent()
|
||||||
{
|
{
|
||||||
return _worldEvent;
|
return _worldEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HologramManager getHologramManager()
|
public HologramManager getHologramManager()
|
||||||
{
|
{
|
||||||
return _hologramManager;
|
return _hologramManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GearManager getGearManager()
|
public GearManager getGearManager()
|
||||||
{
|
{
|
||||||
return _gearManager;
|
return _gearManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LootManager getLootManager()
|
public LootManager getLootManager()
|
||||||
{
|
{
|
||||||
return _lootManager;
|
return _lootManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Chat getChat()
|
public Chat getChat()
|
||||||
{
|
{
|
||||||
return _chat;
|
return _chat;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the timezone for this server.
|
* Get the timezone for this server. This may be used in the future if we
|
||||||
* This may be used in the future if we have
|
* have clans servers with varying timezones.
|
||||||
* clans servers with varying timezones.
|
*
|
||||||
* @return {@link java.util.TimeZone} that this server should run at
|
* @return {@link java.util.TimeZone} that this server should run at
|
||||||
*/
|
*/
|
||||||
public TimeZone getServerTimeZone()
|
public TimeZone getServerTimeZone()
|
||||||
{
|
{
|
||||||
return TIME_ZONE;
|
return TIME_ZONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disable()
|
public void disable()
|
||||||
{
|
{
|
||||||
// Kind of confusing, Clans.java calls this so that we can pass the disable event to WorldEventManager
|
// Kind of confusing, Clans.java calls this so that we can pass the
|
||||||
// This is so that we can prevent any permanent world changes with events
|
// disable event to WorldEventManager
|
||||||
|
// This is so that we can prevent any permanent world changes with
|
||||||
|
// events
|
||||||
_blockRestore.onDisable();
|
_blockRestore.onDisable();
|
||||||
_worldEvent.onDisable();
|
_worldEvent.onDisable();
|
||||||
_goldManager.onDisable();
|
_goldManager.onDisable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onJoin(PlayerLoginEvent event)
|
public void onJoin(PlayerLoginEvent event)
|
||||||
{
|
{
|
||||||
@ -834,7 +863,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
if (!rank.has(Rank.EVENT) && !event.getPlayer().isWhitelisted())
|
if (!rank.has(Rank.EVENT) && !event.getPlayer().isWhitelisted())
|
||||||
{
|
{
|
||||||
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
|
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
|
||||||
// event.setKickMessage("This server is whitelisted!");
|
// event.setKickMessage("This server is whitelisted!");
|
||||||
event.setKickMessage("Clans is currently in staff only Pre-Alpha!");
|
event.setKickMessage("Clans is currently in staff only Pre-Alpha!");
|
||||||
}
|
}
|
||||||
else if (UtilServer.getPlayers().length >= UtilServer.getServer().getMaxPlayers() && !rank.has(Rank.ADMIN) && !event.getPlayer().isWhitelisted())
|
else if (UtilServer.getPlayers().length >= UtilServer.getServer().getMaxPlayers() && !rank.has(Rank.ADMIN) && !event.getPlayer().isWhitelisted())
|
||||||
@ -843,7 +872,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
event.setKickMessage("Clans Pre-Alpha is full! Try again soon");
|
event.setKickMessage("Clans Pre-Alpha is full! Try again soon");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void openShop(PlayerCommandPreprocessEvent event)
|
public void openShop(PlayerCommandPreprocessEvent event)
|
||||||
{
|
{
|
||||||
@ -853,24 +882,24 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void handleClansDeath(PlayerDeathEvent event)
|
public void handleClansDeath(PlayerDeathEvent event)
|
||||||
{
|
{
|
||||||
PlayerClan playerClan;
|
PlayerClan playerClan;
|
||||||
PlayerClan killerClan = null;
|
PlayerClan killerClan = null;
|
||||||
|
|
||||||
Player player = event.getEntity();
|
Player player = event.getEntity();
|
||||||
ClanInfo pClan = _clanMemberUuidMap.get(player.getUniqueId());
|
ClanInfo pClan = _clanMemberUuidMap.get(player.getUniqueId());
|
||||||
playerClan = new PlayerClan(player, pClan);
|
playerClan = new PlayerClan(player, pClan);
|
||||||
|
|
||||||
if (player.getKiller() != null)
|
if (player.getKiller() != null)
|
||||||
{
|
{
|
||||||
Player killer = player.getKiller();
|
Player killer = player.getKiller();
|
||||||
ClanInfo kClan = _clanMemberUuidMap.get(killer.getUniqueId());
|
ClanInfo kClan = _clanMemberUuidMap.get(killer.getUniqueId());
|
||||||
killerClan = new PlayerClan(killer, kClan);
|
killerClan = new PlayerClan(killer, kClan);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClansPlayerDeathEvent clansPlayerDeathEvent = new ClansPlayerDeathEvent(event, playerClan, killerClan);
|
ClansPlayerDeathEvent clansPlayerDeathEvent = new ClansPlayerDeathEvent(event, playerClan, killerClan);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(clansPlayerDeathEvent);
|
Bukkit.getServer().getPluginManager().callEvent(clansPlayerDeathEvent);
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2,6 +2,7 @@ package mineplex.game.clans.clans.commands;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import mineplex.core.command.CommandBase;
|
import mineplex.core.command.CommandBase;
|
||||||
@ -15,7 +16,6 @@ import mineplex.core.common.util.UtilPlayer;
|
|||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
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;
|
||||||
import mineplex.core.recharge.Recharge;
|
|
||||||
import mineplex.core.common.util.UtilWorld;
|
import mineplex.core.common.util.UtilWorld;
|
||||||
import mineplex.game.clans.clans.ClanInfo;
|
import mineplex.game.clans.clans.ClanInfo;
|
||||||
import mineplex.game.clans.clans.ClanRole;
|
import mineplex.game.clans.clans.ClanRole;
|
||||||
@ -24,6 +24,7 @@ import mineplex.game.clans.clans.ClansManager;
|
|||||||
import mineplex.game.clans.clans.ClientClan;
|
import mineplex.game.clans.clans.ClientClan;
|
||||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||||
import mineplex.game.clans.tutorials.TutorialManager;
|
import mineplex.game.clans.tutorials.TutorialManager;
|
||||||
|
import mineplex.game.clans.tutorials.types.ClanTips.TipType;
|
||||||
import net.minecraft.server.v1_8_R3.EnumDirection;
|
import net.minecraft.server.v1_8_R3.EnumDirection;
|
||||||
|
|
||||||
public class ClansCommand extends CommandBase<ClansManager>
|
public class ClansCommand extends CommandBase<ClansManager>
|
||||||
@ -445,28 +446,28 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
}
|
}
|
||||||
|
|
||||||
final String target = UtilPlayer.searchCollection(caller, args[1], clan.getMemberNameSet(), "Clan Member", true);
|
final String target = UtilPlayer.searchCollection(caller, args[1], clan.getMemberNameSet(), "Clan Member", true);
|
||||||
|
|
||||||
_manager.getClanUtility().kick(caller, target);
|
_manager.getClanUtility().kick(caller, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void promote(Player caller, String[] args)
|
public void promote(Player caller, String[] args)
|
||||||
{
|
{
|
||||||
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
||||||
|
|
||||||
if (clan == null)
|
if (clan == null)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length < 2)
|
if (args.length < 2)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main("Clans", "You did not input player to promote."));
|
UtilPlayer.message(caller, F.main("Clans", "You did not input player to promote."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String targetName = UtilPlayer.searchCollection(caller, args[1], clan.getMemberNameSet(), "Clan Member", true);
|
final String targetName = UtilPlayer.searchCollection(caller, args[1], clan.getMemberNameSet(), "Clan Member", true);
|
||||||
|
|
||||||
_manager.getClanUtility().promote(caller, targetName);
|
_manager.getClanUtility().promote(caller, targetName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,7 +488,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
}
|
}
|
||||||
|
|
||||||
final String targetName = UtilPlayer.searchCollection(caller, args[1], clan.getMemberNameSet(), "Clan Member", true);
|
final String targetName = UtilPlayer.searchCollection(caller, args[1], clan.getMemberNameSet(), "Clan Member", true);
|
||||||
|
|
||||||
_manager.getClanUtility().demote(caller, targetName);
|
_manager.getClanUtility().demote(caller, targetName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -735,7 +736,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
|
|
||||||
if (clan.getHome() == null)
|
if (clan.getHome() == null)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main("Clans", "Your Clan has not set a Home."));
|
UtilPlayer.message(caller, F.main("Clans", "Your Clan has not set a Home"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -759,7 +760,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
|
|
||||||
Location home = clan.getHome();
|
Location home = clan.getHome();
|
||||||
|
|
||||||
if (!(home.getBlock().getType().equals(Material.BED_BLOCK) && home.add(0,1,0).getBlock().getType().equals(Material.AIR)))
|
if (!(home.getBlock().getType().equals(Material.BED_BLOCK) && home.add(0, 1, 0).getBlock().getType().equals(Material.AIR)) && home.add(0, 2, 0).getBlock().getType().equals(Material.AIR))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main("Clans", "Your Clan's bed has been destroyed, or is obstructed."));
|
UtilPlayer.message(caller, F.main("Clans", "Your Clan's bed has been destroyed, or is obstructed."));
|
||||||
return;
|
return;
|
||||||
@ -775,10 +776,11 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// if (!Recharge.Instance.use(caller, "Clans Teleport", "Clans Teleport", 300000, true, false, false, false)) return;
|
// if (!Recharge.Instance.use(caller, "Clans Teleport", "Clans
|
||||||
|
// Teleport", 300000, true, false, false, false)) return;
|
||||||
|
|
||||||
// Do
|
// Do
|
||||||
Plugin.getTeleport().TP(caller, clan.getHome());
|
Plugin.getTeleport().TP(caller, clan.getHome().add(0, 1, 0));
|
||||||
|
|
||||||
// Inform
|
// Inform
|
||||||
UtilPlayer.message(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
|
UtilPlayer.message(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
|
||||||
@ -812,8 +814,14 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(caller.getLocation().add(0, 1, 0).getBlock().getType().equals(Material.AIR) && caller.getLocation().add(0, 2, 0).getBlock().getType().equals(Material.AIR)))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("Clans", "This is not a suitable place for a bed."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Place New
|
// Place New
|
||||||
boolean bedPlaced = UtilBlock.placeBed(caller.getLocation(), EnumDirection.fromAngle(caller.getLocation().getYaw()), false, false);
|
boolean bedPlaced = UtilBlock.placeBed(caller.getLocation(), BlockFace.valueOf(EnumDirection.fromAngle(caller.getLocation().getYaw()).name()), false, false);
|
||||||
|
|
||||||
if (!bedPlaced)
|
if (!bedPlaced)
|
||||||
{
|
{
|
||||||
@ -824,11 +832,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
// Cleanup old
|
// Cleanup old
|
||||||
if (clan.getHome() != null)
|
if (clan.getHome() != null)
|
||||||
{
|
{
|
||||||
System.out.println("OLD CLEANUP: " + UtilBlock.deleteBed(clan.getHome()));
|
System.out.println("<-old bed cleanup-> <--> " + UtilBlock.deleteBed(clan.getHome()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Task
|
// Task
|
||||||
Plugin.getClanDataAccess().home(clan, caller.getLocation(), caller.getName());
|
Plugin.getClanDataAccess().setHome(clan, caller.getLocation(), caller.getName());
|
||||||
|
|
||||||
|
Plugin.ClanTips.displayTip(TipType.SETHOME, caller);
|
||||||
|
|
||||||
// Inform
|
// Inform
|
||||||
UtilPlayer.message(caller, F.main("Clans", "You set Clan Home to " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
|
UtilPlayer.message(caller, F.main("Clans", "You set Clan Home to " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
package mineplex.game.clans.clans.event;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class DominanceChangeData
|
|
||||||
{
|
|
||||||
public Player _player;
|
|
||||||
public int _oldDominance;
|
|
||||||
public int _newDominance;
|
|
||||||
|
|
||||||
public DominanceChangeData(Player player, int oldDominance, int newDominance)
|
|
||||||
{
|
|
||||||
_player = player;
|
|
||||||
_oldDominance = oldDominance;
|
|
||||||
_newDominance = newDominance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getOldDominance()
|
|
||||||
{
|
|
||||||
return _oldDominance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getNewDominance()
|
|
||||||
{
|
|
||||||
return _newDominance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Player getPlayer()
|
|
||||||
{
|
|
||||||
return _player;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
package mineplex.game.clans.clans.event;
|
|
||||||
|
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
public class DominanceChangeEvent extends Event
|
|
||||||
{
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
|
|
||||||
private DominanceChangeData _victimData;
|
|
||||||
private DominanceChangeData _killerData;
|
|
||||||
|
|
||||||
public DominanceChangeEvent(DominanceChangeData victimData, DominanceChangeData killerData)
|
|
||||||
{
|
|
||||||
_victimData = victimData;
|
|
||||||
_killerData = killerData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DominanceChangeData getVictimData()
|
|
||||||
{
|
|
||||||
return _victimData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DominanceChangeData getKillerData()
|
|
||||||
{
|
|
||||||
return _killerData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HandlerList getHandlers()
|
|
||||||
{
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList()
|
|
||||||
{
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -5,6 +5,8 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import mineplex.game.clans.clans.ClanInfo;
|
||||||
|
|
||||||
public class PlayerClaimTerritoryEvent extends Event
|
public class PlayerClaimTerritoryEvent extends Event
|
||||||
{
|
{
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
@ -13,11 +15,14 @@ public class PlayerClaimTerritoryEvent extends Event
|
|||||||
private Chunk _claimedChunk;
|
private Chunk _claimedChunk;
|
||||||
|
|
||||||
private boolean _cancelled;
|
private boolean _cancelled;
|
||||||
|
|
||||||
|
private ClanInfo _clan;
|
||||||
|
|
||||||
public PlayerClaimTerritoryEvent(Player claimer, Chunk claimedChunk)
|
public PlayerClaimTerritoryEvent(Player claimer, Chunk claimedChunk, ClanInfo clan)
|
||||||
{
|
{
|
||||||
_claimer = claimer;
|
_claimer = claimer;
|
||||||
_claimedChunk = claimedChunk;
|
_claimedChunk = claimedChunk;
|
||||||
|
_clan = clan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getClaimer()
|
public Player getClaimer()
|
||||||
@ -25,6 +30,11 @@ public class PlayerClaimTerritoryEvent extends Event
|
|||||||
return _claimer;
|
return _claimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ClanInfo getClan()
|
||||||
|
{
|
||||||
|
return _clan;
|
||||||
|
}
|
||||||
|
|
||||||
public Chunk getClaimedChunk()
|
public Chunk getClaimedChunk()
|
||||||
{
|
{
|
||||||
return _claimedChunk;
|
return _claimedChunk;
|
||||||
@ -49,5 +59,5 @@ public class PlayerClaimTerritoryEvent extends Event
|
|||||||
{
|
{
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -304,6 +304,7 @@ public class ClanMainPage extends ClanPageBase
|
|||||||
|
|
||||||
private void addPlayerButton(int slot, ClansPlayer clansPlayer, ClanInfo guiInfo, ClanRole guiRole)
|
private void addPlayerButton(int slot, ClansPlayer clansPlayer, ClanInfo guiInfo, ClanRole guiRole)
|
||||||
{
|
{
|
||||||
|
ClanRole playerRole = clansPlayer.getRole();
|
||||||
String itemName = (clansPlayer.isOnline() ? C.cGreenB : C.cRedB) + clansPlayer.getPlayerName();
|
String itemName = (clansPlayer.isOnline() ? C.cGreenB : C.cRedB) + clansPlayer.getPlayerName();
|
||||||
ArrayList<String> lore = new ArrayList<String>(5);
|
ArrayList<String> lore = new ArrayList<String>(5);
|
||||||
lore.add(" ");
|
lore.add(" ");
|
||||||
@ -323,9 +324,21 @@ public class ClanMainPage extends ClanPageBase
|
|||||||
if (guiRole.has(ClanRole.ADMIN))
|
if (guiRole.has(ClanRole.ADMIN))
|
||||||
{
|
{
|
||||||
lore.add(" ");
|
lore.add(" ");
|
||||||
lore.add(ChatColor.RESET + C.cYellow + "Left Click " + C.cWhite + "Promote");
|
|
||||||
lore.add(ChatColor.RESET + C.cYellow + "Right Click " + C.cWhite + "Demote");
|
if (!playerRole.has(ClanRole.LEADER) && guiRole.has(playerRole))
|
||||||
lore.add(ChatColor.RESET + C.cYellow + "Shift-Right Click " + C.cWhite + "Kick");
|
{
|
||||||
|
lore.add(ChatColor.RESET + C.cYellow + "Left Click " + C.cWhite + "Promote");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!playerRole.has(ClanRole.LEADER) && guiRole.has(playerRole))
|
||||||
|
{
|
||||||
|
lore.add(ChatColor.RESET + C.cYellow + "Right Click " + C.cWhite + "Demote");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!playerRole.has(ClanRole.LEADER))
|
||||||
|
{
|
||||||
|
lore.add(ChatColor.RESET + C.cYellow + "Shift-Right Click " + C.cWhite + "Kick");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack item = UtilSkull.getPlayerHead(clansPlayer.isOnline() ? clansPlayer.getPlayerName() : "", itemName, lore);
|
ItemStack item = UtilSkull.getPlayerHead(clansPlayer.isOnline() ? clansPlayer.getPlayerName() : "", itemName, lore);
|
||||||
|
@ -33,7 +33,7 @@ import mineplex.game.clans.clans.war.command.WarPointsCommand;
|
|||||||
import mineplex.game.clans.clans.war.event.WarInvasionEndEvent;
|
import mineplex.game.clans.clans.war.event.WarInvasionEndEvent;
|
||||||
import mineplex.game.clans.clans.war.event.WarInvasionStartEvent;
|
import mineplex.game.clans.clans.war.event.WarInvasionStartEvent;
|
||||||
import mineplex.game.clans.core.war.ClanWarData;
|
import mineplex.game.clans.core.war.ClanWarData;
|
||||||
import org.omg.CORBA.DynAnyPackage.InvalidSeq;
|
import mineplex.game.clans.tutorials.types.ClanTips.TipType;
|
||||||
|
|
||||||
public class WarManager extends MiniPlugin implements ScoreboardElement
|
public class WarManager extends MiniPlugin implements ScoreboardElement
|
||||||
{
|
{
|
||||||
@ -139,6 +139,9 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
|
|||||||
ClanInfo clanA = clan.getName().equals(war.getClanA()) ? clan : killerClan;
|
ClanInfo clanA = clan.getName().equals(war.getClanA()) ? clan : killerClan;
|
||||||
ClanInfo clanB = clan.equals(clanA) ? killerClan : clan;
|
ClanInfo clanB = clan.equals(clanA) ? killerClan : clan;
|
||||||
_clansManager.getClanDataAccess().updateWar(clanA, clanB, war, null);
|
_clansManager.getClanDataAccess().updateWar(clanA, clanB, war, null);
|
||||||
|
|
||||||
|
_clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer());
|
||||||
|
_clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -4,11 +4,11 @@ import mineplex.core.common.util.UtilMath;
|
|||||||
|
|
||||||
public enum CampSize
|
public enum CampSize
|
||||||
{
|
{
|
||||||
SMALL("Small Camp", 15, 0, 1),
|
SMALL("Undead Outpost", 15, 0, 1),
|
||||||
|
|
||||||
MEDIUM("Medium Camp", 20, 10, 2),
|
MEDIUM("Undead Village", 20, 10, 2),
|
||||||
|
|
||||||
LARGE("Large Camp", 30, 20, 3);
|
LARGE("Undead City", 30, 20, 3);
|
||||||
|
|
||||||
// Base Values
|
// Base Values
|
||||||
private static final int HUT_MIN = 4;
|
private static final int HUT_MIN = 4;
|
||||||
|
@ -43,10 +43,12 @@ 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.UtilGear;
|
import mineplex.core.common.util.UtilGear;
|
||||||
import mineplex.core.common.util.UtilInv;
|
import mineplex.core.common.util.UtilInv;
|
||||||
|
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;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
@ -68,14 +70,15 @@ public class Gameplay extends MiniPlugin
|
|||||||
private ClansManager _clansManager;
|
private ClansManager _clansManager;
|
||||||
private BlockRestore _blockRestore;
|
private BlockRestore _blockRestore;
|
||||||
private DamageManager _damageManager;
|
private DamageManager _damageManager;
|
||||||
private WeightSet<Boolean> _foodDecrease; // Weighted probability sets for food decrease event outcomes
|
private WeightSet<Boolean> _foodDecrease; // Weighted probability sets for
|
||||||
|
// food decrease event outcomes
|
||||||
|
|
||||||
private Map<Block, Long> _bucketWater = new HashMap<Block, Long>();
|
private Map<Block, Long> _bucketWater = new HashMap<Block, Long>();
|
||||||
|
|
||||||
public Gameplay(JavaPlugin plugin, ClansManager clansManager, BlockRestore blockRestore, DamageManager damageManager)
|
public Gameplay(JavaPlugin plugin, ClansManager clansManager, BlockRestore blockRestore, DamageManager damageManager)
|
||||||
{
|
{
|
||||||
super("PvP Gameplay", plugin);
|
super("PvP Gameplay", plugin);
|
||||||
|
|
||||||
_clansManager = clansManager;
|
_clansManager = clansManager;
|
||||||
_blockRestore = blockRestore;
|
_blockRestore = blockRestore;
|
||||||
_damageManager = damageManager;
|
_damageManager = damageManager;
|
||||||
@ -93,7 +96,7 @@ public class Gameplay extends MiniPlugin
|
|||||||
if (state == State.CAUGHT_ENTITY || state == State.CAUGHT_FISH)
|
if (state == State.CAUGHT_ENTITY || state == State.CAUGHT_FISH)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
notify(event.getPlayer(), "Fishing is disabled!");
|
notify(event.getPlayer(), "Fishing is disabled!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,37 +130,40 @@ public class Gameplay extends MiniPlugin
|
|||||||
public void BucketEmpty(PlayerBucketEmptyEvent event)
|
public void BucketEmpty(PlayerBucketEmptyEvent event)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
Block block = event.getBlockClicked().getRelative(event.getBlockFace());
|
Block block = event.getBlockClicked().getRelative(event.getBlockFace());
|
||||||
|
|
||||||
if (event.getBucket() == Material.WATER_BUCKET)
|
if (event.getBucket() == Material.WATER_BUCKET)
|
||||||
{
|
{
|
||||||
block.setTypeIdAndData(8, (byte)1, true);
|
block.setTypeIdAndData(8, (byte) 1, true);
|
||||||
_blockRestore.add(event.getBlockClicked().getRelative(event.getBlockFace()), 8, (byte) 0, 1000);
|
_blockRestore.add(event.getBlockClicked().getRelative(event.getBlockFace()), 8, (byte) 0, 1000);
|
||||||
_bucketWater.put(block, System.currentTimeMillis());
|
_bucketWater.put(block, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getBucket() == Material.LAVA_BUCKET)
|
if (event.getBucket() == Material.LAVA_BUCKET)
|
||||||
{
|
{
|
||||||
block.setTypeIdAndData(10, (byte)6, true);
|
block.setTypeIdAndData(10, (byte) 6, true);
|
||||||
_blockRestore.add(event.getBlockClicked().getRelative(event.getBlockFace()), 10, (byte) 0, 2000);
|
_blockRestore.add(event.getBlockClicked().getRelative(event.getBlockFace()), 10, (byte) 0, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.BUCKET));
|
||||||
event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.BUCKET));
|
|
||||||
UtilInv.Update(event.getPlayer());
|
UtilInv.Update(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decreases the hunger rate decrease speed by arbitrarily canceling a portion of decrease events.
|
* Decreases the hunger rate decrease speed by arbitrarily canceling a
|
||||||
|
* portion of decrease events.
|
||||||
|
*
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
@EventHandler(ignoreCancelled=true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void foodChangeLevel(FoodLevelChangeEvent event)
|
public void foodChangeLevel(FoodLevelChangeEvent event)
|
||||||
{
|
{
|
||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
|
|
||||||
if (event.getFoodLevel() < player.getFoodLevel()) // Hunger is decreasing for player
|
if (event.getFoodLevel() < player.getFoodLevel()) // Hunger is
|
||||||
|
// decreasing for
|
||||||
|
// player
|
||||||
{
|
{
|
||||||
event.setCancelled(_foodDecrease.generateRandom());
|
event.setCancelled(_foodDecrease.generateRandom());
|
||||||
}
|
}
|
||||||
@ -167,30 +173,26 @@ public class Gameplay extends MiniPlugin
|
|||||||
public void BucketFill(PlayerBucketFillEvent event)
|
public void BucketFill(PlayerBucketFillEvent event)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
if (event.getItemStack().getType() == Material.WATER_BUCKET)
|
if (event.getItemStack().getType() == Material.WATER_BUCKET) if (!_bucketWater.containsKey(event.getBlockClicked())) event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.WATER_BUCKET));
|
||||||
if (!_bucketWater.containsKey(event.getBlockClicked()))
|
|
||||||
event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.WATER_BUCKET));
|
|
||||||
|
|
||||||
UtilInv.Update(event.getPlayer());
|
UtilInv.Update(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void BucketWaterExpire(UpdateEvent event)
|
public void BucketWaterExpire(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.FAST)
|
if (event.getType() != UpdateType.FAST) return;
|
||||||
return;
|
|
||||||
|
|
||||||
HashSet<Block> remove = new HashSet<Block>();
|
HashSet<Block> remove = new HashSet<Block>();
|
||||||
|
|
||||||
for (Block cur : _bucketWater.keySet())
|
for (Block cur : _bucketWater.keySet())
|
||||||
if (UtilTime.elapsed(_bucketWater.get(cur), 2000))
|
if (UtilTime.elapsed(_bucketWater.get(cur), 2000)) remove.add(cur);
|
||||||
remove.add(cur);
|
|
||||||
|
|
||||||
for (Block cur : remove)
|
for (Block cur : remove)
|
||||||
_bucketWater.remove(cur);
|
_bucketWater.remove(cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void ObsidianCancel(BlockPlaceEvent event)
|
public void ObsidianCancel(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
@ -204,9 +206,7 @@ public class Gameplay extends MiniPlugin
|
|||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void CommandPlace(BlockPlaceEvent event)
|
public void CommandPlace(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
if (event.getBlock().getType() == Material.COMMAND ||
|
if (event.getBlock().getType() == Material.COMMAND || event.getBlock().getType() == Material.NOTE_BLOCK || event.getBlock().getType() == Material.REDSTONE_LAMP_ON)
|
||||||
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") + "."));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -225,20 +225,22 @@ public class Gameplay extends MiniPlugin
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable all Piston related events in Clans
|
* Disable all Piston related events in Clans
|
||||||
|
*
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPistonExtend(BlockPistonExtendEvent event)
|
public void onPistonExtend(BlockPistonExtendEvent event)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable all Piston related events in Clans
|
* Disable all Piston related events in Clans
|
||||||
|
*
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPistonRetract(BlockPistonRetractEvent event)
|
public void onPistonRetract(BlockPistonRetractEvent event)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -248,8 +250,7 @@ public class Gameplay extends MiniPlugin
|
|||||||
{
|
{
|
||||||
Material material = event.getItem().getType();
|
Material material = event.getItem().getType();
|
||||||
|
|
||||||
if (material == Material.LAVA_BUCKET || material == Material.LAVA
|
if (material == Material.LAVA_BUCKET || material == Material.LAVA || material == Material.WATER_BUCKET || material == Material.WATER)
|
||||||
|| material == Material.WATER_BUCKET || material == Material.WATER)
|
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -258,25 +259,21 @@ public class Gameplay extends MiniPlugin
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void WebBreak(BlockDamageEvent event)
|
public void WebBreak(BlockDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled()) return;
|
||||||
return;
|
|
||||||
|
if (event.getBlock().getType() == Material.WEB) event.setInstaBreak(true);
|
||||||
if (event.getBlock().getType() == Material.WEB)
|
|
||||||
event.setInstaBreak(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void LapisPlace(BlockPlaceEvent event)
|
public void LapisPlace(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled()) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (event.getBlock().getType() != Material.LAPIS_BLOCK)
|
|
||||||
return;
|
|
||||||
|
|
||||||
event.setCancelled(true);
|
if (event.getBlock().getType() != Material.LAPIS_BLOCK) return;
|
||||||
|
|
||||||
UtilInv.remove(event.getPlayer(), Material.LAPIS_BLOCK, (byte)0, 1);
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
UtilInv.remove(event.getPlayer(), Material.LAPIS_BLOCK, (byte) 0, 1);
|
||||||
|
|
||||||
final Block block = event.getBlock();
|
final Block block = event.getBlock();
|
||||||
|
|
||||||
@ -285,7 +282,7 @@ public class Gameplay extends MiniPlugin
|
|||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
block.setType(Material.WATER);
|
block.setType(Material.WATER);
|
||||||
block.setData((byte)0);
|
block.setData((byte) 0);
|
||||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 8);
|
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 8);
|
||||||
block.getWorld().playSound(block.getLocation(), Sound.SPLASH, 2f, 1f);
|
block.getWorld().playSound(block.getLocation(), Sound.SPLASH, 2f, 1f);
|
||||||
}
|
}
|
||||||
@ -295,23 +292,20 @@ public class Gameplay extends MiniPlugin
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void EnderChestBreak(BlockBreakEvent event)
|
public void EnderChestBreak(BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled()) return;
|
||||||
return;
|
|
||||||
|
if (event.getBlock().getType() != Material.ENDER_CHEST) return;
|
||||||
|
|
||||||
if (event.getBlock().getType() != Material.ENDER_CHEST)
|
|
||||||
return;
|
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
event.getBlock().setTypeId(0);
|
event.getBlock().setTypeId(0);
|
||||||
event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().add(0.5, 0.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.ENDER_CHEST));
|
event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().add(0.5, 0.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.ENDER_CHEST));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void disableEnderPearls(PlayerInteractEvent event)
|
public void disableEnderPearls(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
if (!isRightClick(event.getAction()))
|
if (!isRightClick(event.getAction())) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (event.hasItem() && event.getItem().getType() == Material.ENDER_PEARL)
|
if (event.hasItem() && event.getItem().getType() == Material.ENDER_PEARL)
|
||||||
{
|
{
|
||||||
@ -323,8 +317,7 @@ public class Gameplay extends MiniPlugin
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void disableFlintNSteel(PlayerInteractEvent event)
|
public void disableFlintNSteel(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
if (!isRightClick(event.getAction()))
|
if (!isRightClick(event.getAction())) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (event.hasItem() && event.getItem().getType() == Material.FLINT_AND_STEEL)
|
if (event.hasItem() && event.getItem().getType() == Material.FLINT_AND_STEEL)
|
||||||
{
|
{
|
||||||
@ -335,52 +328,48 @@ public class Gameplay extends MiniPlugin
|
|||||||
|
|
||||||
private static boolean isRightClick(Action action)
|
private static boolean isRightClick(Action action)
|
||||||
{
|
{
|
||||||
return action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK;
|
return action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void IronDoor(PlayerInteractEvent event)
|
public void IronDoor(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
|
if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) return;
|
||||||
return;
|
|
||||||
|
if (event.getClickedBlock().getTypeId() != 71) return;
|
||||||
if (event.getClickedBlock().getTypeId() != 71)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Block block = event.getClickedBlock();
|
Block block = event.getClickedBlock();
|
||||||
|
|
||||||
//Knock
|
// Knock
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
{
|
{
|
||||||
if (!Recharge.Instance.use(event.getPlayer(), "Door Knock", 500, false, false))
|
if (!Recharge.Instance.use(event.getPlayer(), "Door Knock", 500, false, false)) return;
|
||||||
return;
|
|
||||||
|
|
||||||
block.getWorld().playEffect(block.getLocation(), Effect.ZOMBIE_CHEW_WOODEN_DOOR, 0);
|
block.getWorld().playEffect(block.getLocation(), Effect.ZOMBIE_CHEW_WOODEN_DOOR, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Open
|
// Open
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (block.getData() >= 8)
|
if (block.getData() >= 8) block = block.getRelative(BlockFace.DOWN);
|
||||||
block = block.getRelative(BlockFace.DOWN);
|
|
||||||
|
if (block.getData() < 4)
|
||||||
if (block.getData() < 4) block.setData((byte)(block.getData()+4), true);
|
block.setData((byte) (block.getData() + 4), true);
|
||||||
else block.setData((byte)(block.getData()-4), true);
|
else
|
||||||
|
block.setData((byte) (block.getData() - 4), true);
|
||||||
//Effect
|
|
||||||
|
// Effect
|
||||||
block.getWorld().playEffect(block.getLocation(), Effect.DOOR_TOGGLE, 0);
|
block.getWorld().playEffect(block.getLocation(), Effect.DOOR_TOGGLE, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void BrewingDisable(PlayerInteractEvent event)
|
public void BrewingDisable(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
|
if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) return;
|
||||||
return;
|
|
||||||
|
if (event.getClickedBlock().getTypeId() != 117) return;
|
||||||
if (event.getClickedBlock().getTypeId() != 117)
|
|
||||||
return;
|
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,172 +378,183 @@ public class Gameplay extends MiniPlugin
|
|||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) return;
|
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
|
||||||
else if (event.getClickedBlock().getType() != Material.ANVIL) return;
|
return;
|
||||||
|
else if (event.getClickedBlock().getType() != Material.ANVIL)
|
||||||
|
return;
|
||||||
else if (player.isSneaking() && player.getItemInHand().getType() != Material.AIR) return;
|
else if (player.isSneaking() && player.getItemInHand().getType() != Material.AIR) return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void BonemealCancel(PlayerInteractEvent event)
|
public void BonemealCancel(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
if (!UtilEvent.isAction(event, ActionType.R))
|
if (!UtilEvent.isAction(event, ActionType.R)) return;
|
||||||
return;
|
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (player.getItemInHand() == null)
|
if (player.getItemInHand() == null) return;
|
||||||
return;
|
|
||||||
|
if (player.getItemInHand().getType() != Material.INK_SACK) return;
|
||||||
if (player.getItemInHand().getType() != Material.INK_SACK)
|
|
||||||
return;
|
if (player.getItemInHand().getData() == null) return;
|
||||||
|
|
||||||
if (player.getItemInHand().getData() == null)
|
if (player.getItemInHand().getData().getData() != 15) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (player.getItemInHand().getData().getData() != 15)
|
|
||||||
return;
|
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void replantTree(BlockBreakEvent event)
|
||||||
|
{
|
||||||
|
Block block = event.getBlock();
|
||||||
|
|
||||||
|
if (!UtilItem.isLog(block.getType()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UtilItem.isLog(block.getRelative(BlockFace.DOWN).getType()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UtilItem.isLeaf(block.getRelative(BlockFace.DOWN).getType()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (block.getRelative(BlockFace.DOWN).getType() != Material.DIRT && block.getRelative(BlockFace.DOWN).getType() != Material.GRASS)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Location saplingArea = null;
|
||||||
|
|
||||||
|
for (Block otherBlock : UtilBlock.getInRadius(event.getBlock().getLocation(), 4.5).keySet())
|
||||||
|
{
|
||||||
|
if (!otherBlock.equals(UtilBlock.getHighest(otherBlock.getLocation().getWorld(), otherBlock.getX(), otherBlock.getZ())))
|
||||||
|
{
|
||||||
|
saplingArea = otherBlock.getLocation();
|
||||||
|
if (Math.random() > .75)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
saplingArea.add(0, 1, 0).getBlock().setType(Material.SAPLING);
|
||||||
|
saplingArea.getBlock().setData(block.getData());
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void WildfireSpread(BlockBurnEvent event)
|
public void WildfireSpread(BlockBurnEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled()) return;
|
||||||
return;
|
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
for (int x=-1 ; x<=1 ; x++)
|
for (int x = -1; x <= 1; x++)
|
||||||
for (int y=-1 ; y<=1 ; y++)
|
for (int y = -1; y <= 1; y++)
|
||||||
for (int z=-1 ; z<=1 ; z++)
|
for (int z = -1; z <= 1; z++)
|
||||||
{
|
{
|
||||||
//Self
|
// Self
|
||||||
if (x == 0 && y == 0 && z == 0)
|
if (x == 0 && y == 0 && z == 0)
|
||||||
{
|
{
|
||||||
event.getBlock().setType(Material.FIRE);
|
event.getBlock().setType(Material.FIRE);
|
||||||
|
|
||||||
if (event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.GRASS)
|
if (event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.GRASS) event.getBlock().getRelative(BlockFace.DOWN).setType(Material.DIRT);
|
||||||
event.getBlock().getRelative(BlockFace.DOWN).setType(Material.DIRT);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Block block = event.getBlock().getRelative(x, y, z);
|
Block block = event.getBlock().getRelative(x, y, z);
|
||||||
|
|
||||||
if (block.getRelative(BlockFace.DOWN).getType() == Material.GRASS)
|
if (block.getRelative(BlockFace.DOWN).getType() == Material.GRASS) block.getRelative(BlockFace.DOWN).setType(Material.DIRT);
|
||||||
block.getRelative(BlockFace.DOWN).setType(Material.DIRT);
|
|
||||||
|
|
||||||
//Surroundings
|
// Surroundings
|
||||||
if (!(
|
if (!((x == 0 && y == 0) || (x == 0 && z == 0) || (y == 0 && z == 0))) continue;
|
||||||
(x == 0 && y == 0) ||
|
|
||||||
(x == 0 && z == 0) ||
|
if (block.getTypeId() == 0) block.setType(Material.FIRE);
|
||||||
(y == 0 && z == 0)
|
|
||||||
))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (block.getTypeId() == 0)
|
|
||||||
block.setType(Material.FIRE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void WildfireDirt(BlockIgniteEvent event)
|
public void WildfireDirt(BlockIgniteEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled()) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.GRASS)
|
if (event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.GRASS) event.getBlock().getRelative(BlockFace.DOWN).setType(Material.DIRT);
|
||||||
event.getBlock().getRelative(BlockFace.DOWN).setType(Material.DIRT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void WildfireCancel(BlockIgniteEvent event)
|
public void WildfireCancel(BlockIgniteEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled()) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (event.getBlock().getBiome() == Biome.JUNGLE || event.getBlock().getBiome() == Biome.JUNGLE_HILLS)
|
if (event.getBlock().getBiome() == Biome.JUNGLE || event.getBlock().getBiome() == Biome.JUNGLE_HILLS) if (event.getCause() == IgniteCause.SPREAD) event.setCancelled(true);
|
||||||
if (event.getCause() == IgniteCause.SPREAD)
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @EventHandler
|
// @EventHandler
|
||||||
// public void onBlockPlace(BlockPlaceEvent event)
|
// public void onBlockPlace(BlockPlaceEvent event)
|
||||||
// {
|
// {
|
||||||
// Location location = event.getBlock().getLocation();
|
// Location location = event.getBlock().getLocation();
|
||||||
//
|
//
|
||||||
// if (_clansManager.getClanUtility().isNearAdminClaim(location))
|
// if (_clansManager.getClanUtility().isNearAdminClaim(location))
|
||||||
// {
|
// {
|
||||||
// event.setCancelled(true);
|
// event.setCancelled(true);
|
||||||
// UtilPlayer.message(event.getPlayer(), F.main("Admin", "You cannot place blocks near admin territories!"));
|
// UtilPlayer.message(event.getPlayer(), F.main("Admin", "You cannot place
|
||||||
// }
|
// blocks near admin territories!"));
|
||||||
// }
|
// }
|
||||||
//
|
// }
|
||||||
// @EventHandler
|
//
|
||||||
// public void onBlockBreak(BlockBreakEvent event)
|
// @EventHandler
|
||||||
// {
|
// public void onBlockBreak(BlockBreakEvent event)
|
||||||
// Location location = event.getBlock().getLocation();
|
// {
|
||||||
//
|
// Location location = event.getBlock().getLocation();
|
||||||
// if (_clansManager.getClanUtility().isNearAdminClaim(location))
|
//
|
||||||
// {
|
// if (_clansManager.getClanUtility().isNearAdminClaim(location))
|
||||||
// event.setCancelled(true);
|
// {
|
||||||
// UtilPlayer.message(event.getPlayer(), F.main("Admin", "You cannot break blocks near admin territories!"));
|
// event.setCancelled(true);
|
||||||
// }
|
// UtilPlayer.message(event.getPlayer(), F.main("Admin", "You cannot break
|
||||||
// }
|
// blocks near admin territories!"));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@EventHandler (priority = EventPriority.HIGHEST)
|
* @EventHandler (priority = EventPriority.HIGHEST) public void
|
||||||
public void MoneyLossSteal(CombatDeathEvent event)
|
* MoneyLossSteal(CombatDeathEvent event) { if
|
||||||
{
|
* (!(event.GetEvent().getEntity() instanceof Player)) return; Player player
|
||||||
if (!(event.GetEvent().getEntity() instanceof Player))
|
* = (Player)event.GetEvent().getEntity(); int balance =
|
||||||
return;
|
* Clients().Get(player).Game().GetEconomyBalance(); int lose = (int) (0.04
|
||||||
|
* * balance); //Balance
|
||||||
Player player = (Player)event.GetEvent().getEntity();
|
* Clients().Get(player).Game().SetEconomyBalance(balance - lose); CombatLog
|
||||||
|
* log = event.GetLog(); if (log.GetKiller() != null) { //Inform
|
||||||
int balance = Clients().Get(player).Game().GetEconomyBalance();
|
* UtilPlayer.message(UtilPlayer.searchExact(log.GetKiller().getName()),
|
||||||
|
* F.main("Death", "You stole " + F.count((lose) + " Coins") + " from " +
|
||||||
int lose = (int) (0.04 * balance);
|
* F.name(player.getName()) + ".")); //Inform UtilPlayer.message(player,
|
||||||
|
* F.main("Death", "You lost " + F.count((lose) + " Coins") + " to " +
|
||||||
//Balance
|
* F.name(log.GetKiller().getName()) + ".")); } else { //Inform
|
||||||
Clients().Get(player).Game().SetEconomyBalance(balance - lose);
|
* UtilPlayer.message(player, F.main("Death", "You lost " + F.count((lose) +
|
||||||
|
* " Coins") + " for dying.")); } }
|
||||||
CombatLog log = event.GetLog();
|
*/
|
||||||
if (log.GetKiller() != null)
|
|
||||||
{
|
|
||||||
//Inform
|
|
||||||
UtilPlayer.message(UtilPlayer.searchExact(log.GetKiller().getName()), F.main("Death", "You stole " + F.count((lose) + " Coins") + " from " + F.name(player.getName()) + "."));
|
|
||||||
|
|
||||||
//Inform
|
|
||||||
UtilPlayer.message(player, F.main("Death", "You lost " + F.count((lose) + " Coins") + " to " + F.name(log.GetKiller().getName()) + "."));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Inform
|
|
||||||
UtilPlayer.message(player, F.main("Death", "You lost " + F.count((lose) + " Coins") + " for dying."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void SpawnDamage(CustomDamageEvent event)
|
public void SpawnDamage(CustomDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event.IsCancelled())
|
if (event.IsCancelled()) return;
|
||||||
return;
|
|
||||||
|
if (event.GetCause() != DamageCause.FALL) return;
|
||||||
if (event.GetCause() != DamageCause.FALL)
|
|
||||||
return;
|
if (!_clansManager.getClanUtility().isSpecial(event.GetDamageeEntity().getLocation(), "Spawn")) return;
|
||||||
|
|
||||||
if (!_clansManager.getClanUtility().isSpecial(event.GetDamageeEntity().getLocation(), "Spawn"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
event.SetCancelled("Spawn Fall");
|
event.SetCancelled("Spawn Fall");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel the spawning of all Witches.
|
* Cancel the spawning of all Witches.
|
||||||
|
*
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -571,11 +571,7 @@ public class Gameplay extends MiniPlugin
|
|||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (event.getClickedBlock() == null
|
if (event.getClickedBlock() == null || event.getClickedBlock().getType() != Material.ANVIL || !UtilEvent.isAction(event, ActionType.R_BLOCK) || player.isSneaking() || player.getItemInHand().getType() == Material.AIR)
|
||||||
|| event.getClickedBlock().getType() != Material.ANVIL
|
|
||||||
|| !UtilEvent.isAction(event, ActionType.R_BLOCK)
|
|
||||||
|| player.isSneaking()
|
|
||||||
|| player.getItemInHand().getType() == Material.AIR)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -585,7 +581,7 @@ public class Gameplay extends MiniPlugin
|
|||||||
UtilPlayer.message(player, F.main("Repair", "You are too far from the " + F.item("Anvil") + "."));
|
UtilPlayer.message(player, F.main("Repair", "You are too far from the " + F.item("Anvil") + "."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack item = player.getItemInHand();
|
ItemStack item = player.getItemInHand();
|
||||||
|
|
||||||
if (item.getDurability() <= 0)
|
if (item.getDurability() <= 0)
|
||||||
@ -599,46 +595,44 @@ public class Gameplay extends MiniPlugin
|
|||||||
UtilPlayer.message(player, F.main("Repair", "You cannot repair " + F.item(item.getItemMeta().getDisplayName()) + "."));
|
UtilPlayer.message(player, F.main("Repair", "You cannot repair " + F.item(item.getItemMeta().getDisplayName()) + "."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int repairs = ItemStackFactory.Instance.GetLoreVar(item, "Repaired", 0);
|
int repairs = ItemStackFactory.Instance.GetLoreVar(item, "Repaired", 0);
|
||||||
boolean canRepair = canRepair(item);
|
boolean canRepair = canRepair(item);
|
||||||
|
|
||||||
if (!canRepair)
|
if (!canRepair)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, F.main("Repair", "This item cannot be repaired anymore."));
|
UtilPlayer.message(player, F.main("Repair", "This item cannot be repaired anymore."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String creator = ItemStackFactory.Instance.GetLoreVar(item, "Owner");
|
String creator = ItemStackFactory.Instance.GetLoreVar(item, "Owner");
|
||||||
|
|
||||||
if (creator != null)
|
if (creator != null)
|
||||||
{
|
{
|
||||||
if (creator.length() > 2)
|
if (creator.length() > 2) creator = creator.substring(2, creator.length());
|
||||||
creator = creator.substring(2, creator.length());
|
|
||||||
|
|
||||||
if (!creator.equals(player.getName()))
|
if (!creator.equals(player.getName()))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, F.main("Repair", "You cannot repair " + F.item(item.getItemMeta().getDisplayName()) + " by " + F.name(creator) + "."));
|
UtilPlayer.message(player, F.main("Repair", "You cannot repair " + F.item(item.getItemMeta().getDisplayName()) + " by " + F.name(creator) + "."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Repair!
|
// Repair!
|
||||||
UtilPlayer.message(player, F.main("Repair", "You repaired " + F.item(item.getItemMeta().getDisplayName()) + "."));
|
UtilPlayer.message(player, F.main("Repair", "You repaired " + F.item(item.getItemMeta().getDisplayName()) + "."));
|
||||||
item.setDurability((short)0);
|
item.setDurability((short) 0);
|
||||||
UtilInv.Update(player);
|
UtilInv.Update(player);
|
||||||
|
|
||||||
//Break
|
// Break
|
||||||
if (Math.random() > 0.85)
|
if (Math.random() > 0.85) event.getClickedBlock().setData((byte) (event.getClickedBlock().getData() + 4));
|
||||||
event.getClickedBlock().setData((byte) (event.getClickedBlock().getData() + 4));
|
|
||||||
|
|
||||||
if (event.getClickedBlock().getData() >= 12)
|
if (event.getClickedBlock().getData() >= 12)
|
||||||
{
|
{
|
||||||
player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, 145);
|
player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, 145);
|
||||||
event.getClickedBlock().setTypeIdAndData(0, (byte)0, true);
|
event.getClickedBlock().setTypeIdAndData(0, (byte) 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Record
|
// Record
|
||||||
ItemStackFactory.Instance.SetLoreVar(item, "Repaired", (repairs + 1) + "");
|
ItemStackFactory.Instance.SetLoreVar(item, "Repaired", (repairs + 1) + "");
|
||||||
if (!canRepair(item))
|
if (!canRepair(item))
|
||||||
{
|
{
|
||||||
@ -647,24 +641,23 @@ public class Gameplay extends MiniPlugin
|
|||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Effect
|
// Effect
|
||||||
player.playSound(player.getLocation(), Sound.ANVIL_USE, 1f, 1f);
|
player.playSound(player.getLocation(), Sound.ANVIL_USE, 1f, 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canRepair(ItemStack item)
|
private boolean canRepair(ItemStack item)
|
||||||
{
|
{
|
||||||
int repairs = ItemStackFactory.Instance.GetLoreVar(item, "Repaired", 0);
|
int repairs = ItemStackFactory.Instance.GetLoreVar(item, "Repaired", 0);
|
||||||
boolean gold = UtilGear.isGold(item);
|
boolean gold = UtilGear.isGold(item);
|
||||||
boolean canRepair = true;
|
boolean canRepair = true;
|
||||||
|
|
||||||
if (repairs >= 3 && gold)
|
if (repairs >= 3 && gold)
|
||||||
canRepair = false;
|
canRepair = false;
|
||||||
else if (repairs >= 2 && !gold)
|
else if (repairs >= 2 && !gold) canRepair = false;
|
||||||
canRepair = false;
|
|
||||||
|
|
||||||
return canRepair;
|
return canRepair;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DamageManager getDamageManager()
|
public DamageManager getDamageManager()
|
||||||
{
|
{
|
||||||
return _damageManager;
|
return _damageManager;
|
||||||
|
@ -16,20 +16,7 @@ public class PvpItem extends ShopItem
|
|||||||
|
|
||||||
public PvpItem(Material type, byte data, int displayAmount, String name, int price, int bulkCount)
|
public PvpItem(Material type, byte data, int displayAmount, String name, int price, int bulkCount)
|
||||||
{
|
{
|
||||||
super(type, data, name, new String[]
|
super(type, data, name, new String[] { C.cWhite + " ", LEFT_CLICK_BUY, C.cWhite + "Costs " + C.cGreen + price + "g", C.cWhite + " ", C.cYellow + "Shift Left-Click" + C.cWhite + " to Buy " + C.cGreen + bulkCount, C.cWhite + "Costs " + C.cGreen + (price * bulkCount) + "g", C.cWhite + " ", RIGHT_CLICK_SELL, C.cWhite + "Earns " + C.cGreen + (int) (price / 2) + "g", C.cWhite + " ", C.cYellow + "Shift Right-Click" + C.cWhite + " to Sell " + C.cGreen + "All", }, 0, false, false);
|
||||||
{
|
|
||||||
C.cWhite + " ",
|
|
||||||
LEFT_CLICK_BUY,
|
|
||||||
C.cWhite + "Costs " + C.cGreen + "$" + price,
|
|
||||||
C.cWhite + " ",
|
|
||||||
C.cYellow + "Shift Left-Click" + C.cWhite + " to Buy " + C.cGreen + bulkCount,
|
|
||||||
C.cWhite + "Costs " + C.cGreen + "$" + (price * bulkCount),
|
|
||||||
C.cWhite + " ",
|
|
||||||
RIGHT_CLICK_SELL,
|
|
||||||
C.cWhite + "Earns " + C.cGreen + "$" + (int)(price / 2),
|
|
||||||
C.cWhite + " ",
|
|
||||||
C.cYellow + "Shift Right-Click" + C.cWhite + " to Sell " + C.cGreen + "All",
|
|
||||||
}, 0, false, false);
|
|
||||||
|
|
||||||
_price = price;
|
_price = price;
|
||||||
_sellPrice = (int) (price / 2);
|
_sellPrice = (int) (price / 2);
|
||||||
@ -38,20 +25,7 @@ public class PvpItem extends ShopItem
|
|||||||
|
|
||||||
public PvpItem(Material type, byte data, int displayAmount, String name, int buyPrice, int sellPrice, int bulkCount)
|
public PvpItem(Material type, byte data, int displayAmount, String name, int buyPrice, int sellPrice, int bulkCount)
|
||||||
{
|
{
|
||||||
super(type, data, name, new String[]
|
super(type, data, name, new String[] { C.cWhite + " ", LEFT_CLICK_BUY, C.cWhite + "Costs " + C.cGreen + buyPrice + "g", C.cWhite + " ", C.cYellow + "Shift Left-Click" + C.cWhite + " to Buy " + C.cGreen + bulkCount, C.cWhite + "Costs " + C.cGreen + (buyPrice * bulkCount) + "g", C.cWhite + " ", RIGHT_CLICK_SELL, C.cWhite + "Earns " + C.cGreen + sellPrice + "g", C.cWhite + " ", C.cYellow + "Shift Right-Click" + C.cWhite + " to Sell " + C.cGreen + "All", }, 0, false, false);
|
||||||
{
|
|
||||||
C.cWhite + " ",
|
|
||||||
LEFT_CLICK_BUY,
|
|
||||||
C.cWhite + "Costs " + C.cGreen + "$" + buyPrice,
|
|
||||||
C.cWhite + " ",
|
|
||||||
C.cYellow + "Shift Left-Click" + C.cWhite + " to Buy " + C.cGreen + bulkCount,
|
|
||||||
C.cWhite + "Costs " + C.cGreen + "$" + (buyPrice * bulkCount),
|
|
||||||
C.cWhite + " ",
|
|
||||||
RIGHT_CLICK_SELL,
|
|
||||||
C.cWhite + "Earns " + C.cGreen + "$" + sellPrice,
|
|
||||||
C.cWhite + " ",
|
|
||||||
C.cYellow + "Shift Right-Click" + C.cWhite + " to Sell " + C.cGreen + "All",
|
|
||||||
}, 0, false, false);
|
|
||||||
|
|
||||||
_price = buyPrice;
|
_price = buyPrice;
|
||||||
_sellPrice = sellPrice;
|
_sellPrice = sellPrice;
|
||||||
@ -60,17 +34,7 @@ public class PvpItem extends ShopItem
|
|||||||
|
|
||||||
public PvpItem(Material type, byte data, int displayAmount, String name, int price)
|
public PvpItem(Material type, byte data, int displayAmount, String name, int price)
|
||||||
{
|
{
|
||||||
super(type, data, name, new String[]
|
super(type, data, name, new String[] { C.cWhite + " ", LEFT_CLICK_BUY, C.cWhite + "Costs " + C.cGreen + price + "g", C.cWhite + " ", RIGHT_CLICK_SELL, C.cWhite + "Earns " + C.cGreen + (int) (price / 2) + "g", C.cWhite + " ", C.cYellow + "Shift Right-Click" + C.cWhite + " to Sell " + C.cGreen + "All", }, 0, false, false);
|
||||||
{
|
|
||||||
C.cWhite + " ",
|
|
||||||
LEFT_CLICK_BUY,
|
|
||||||
C.cWhite + "Costs " + C.cGreen + "$" + price,
|
|
||||||
C.cWhite + " ",
|
|
||||||
RIGHT_CLICK_SELL,
|
|
||||||
C.cWhite + "Earns " + C.cGreen + "$" + (int)(price / 2),
|
|
||||||
C.cWhite + " ",
|
|
||||||
C.cYellow + "Shift Right-Click" + C.cWhite + " to Sell " + C.cGreen + "All",
|
|
||||||
}, 0, false, false);
|
|
||||||
|
|
||||||
_price = price;
|
_price = price;
|
||||||
_bulkCount = -1;
|
_bulkCount = -1;
|
||||||
@ -80,7 +44,7 @@ public class PvpItem extends ShopItem
|
|||||||
{
|
{
|
||||||
return _price;
|
return _price;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSellPrice()
|
public int getSellPrice()
|
||||||
{
|
{
|
||||||
return _sellPrice;
|
return _sellPrice;
|
||||||
|
@ -22,7 +22,7 @@ public class EnergyPage extends ShopPageBase<ClanEnergyManager, EnergyShop>
|
|||||||
super(plugin, shop, clientManager, donationManager, "Energy Shop", player, 18);
|
super(plugin, shop, clientManager, donationManager, "Energy Shop", player, 18);
|
||||||
buildPage();
|
buildPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void buildPage()
|
protected void buildPage()
|
||||||
{
|
{
|
||||||
@ -35,20 +35,20 @@ public class EnergyPage extends ShopPageBase<ClanEnergyManager, EnergyShop>
|
|||||||
buildPurchase(clanInfo);
|
buildPurchase(clanInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildPurchase(ClanInfo clanInfo)
|
private void buildPurchase(ClanInfo clanInfo)
|
||||||
{
|
{
|
||||||
int energyPerMin = Math.max(1, clanInfo.getEnergyCostPerMinute());
|
int energyPerMin = Math.max(1, clanInfo.getEnergyCostPerMinute());
|
||||||
|
|
||||||
int oneHourEnergy = energyPerMin * 60;
|
int oneHourEnergy = energyPerMin * 60;
|
||||||
int oneDayEnergy = oneHourEnergy * 24;
|
int oneDayEnergy = oneHourEnergy * 24;
|
||||||
int maxEnergy = clanInfo.getEnergyPurchasable();
|
int maxEnergy = clanInfo.getEnergyPurchasable();
|
||||||
|
|
||||||
addButton(clanInfo, 11, oneHourEnergy, Material.REDSTONE, (byte) 0, " ", ChatColor.RESET + "1 Hour of Energy", " ", ChatColor.RESET + "Costs " + C.cGreen + "$" + getPlugin().convertEnergyToGold(oneHourEnergy));
|
addButton(clanInfo, 11, oneHourEnergy, Material.REDSTONE, (byte) 0, " ", ChatColor.RESET + "1 Hour of Energy", " ", ChatColor.RESET + "Costs " + C.cGreen + getPlugin().convertEnergyToGold(oneHourEnergy) + "g");
|
||||||
addButton(clanInfo, 13, oneDayEnergy, Material.REDSTONE_BLOCK, (byte) 0, " ", ChatColor.RESET + "1 Day of Energy", " ", ChatColor.RESET + "Costs " + C.cGreen + "$" + getPlugin().convertEnergyToGold(oneDayEnergy));
|
addButton(clanInfo, 13, oneDayEnergy, Material.REDSTONE_BLOCK, (byte) 0, " ", ChatColor.RESET + "1 Day of Energy", " ", ChatColor.RESET + "Costs " + C.cGreen + getPlugin().convertEnergyToGold(oneDayEnergy) + "g");
|
||||||
addButton(clanInfo, 15, maxEnergy, Material.FURNACE, (byte) 0, " ", ChatColor.RESET + "Maxed Out Energy", " ", ChatColor.RESET + "Costs " + C.cGreen + "$" + getPlugin().convertEnergyToGold(maxEnergy));
|
addButton(clanInfo, 15, maxEnergy, Material.FURNACE, (byte) 0, " ", ChatColor.RESET + "Maxed Out Energy", " ", ChatColor.RESET + "Costs " + C.cGreen + getPlugin().convertEnergyToGold(maxEnergy) + "g");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addInfo(ClanInfo clanInfo, int slot)
|
private void addInfo(ClanInfo clanInfo, int slot)
|
||||||
{
|
{
|
||||||
String itemName = clanInfo.getName();
|
String itemName = clanInfo.getName();
|
||||||
@ -57,29 +57,28 @@ public class EnergyPage extends ShopPageBase<ClanEnergyManager, EnergyShop>
|
|||||||
lore.add(C.cYellow + "Energy: " + ChatColor.RESET + clanInfo.getEnergy());
|
lore.add(C.cYellow + "Energy: " + ChatColor.RESET + clanInfo.getEnergy());
|
||||||
lore.add(C.cYellow + "Drain: " + ChatColor.RESET + clanInfo.getEnergyCostPerMinute() * 60 + " per Hour");
|
lore.add(C.cYellow + "Drain: " + ChatColor.RESET + clanInfo.getEnergyCostPerMinute() * 60 + " per Hour");
|
||||||
lore.add(C.cYellow + "Max Energy: " + ChatColor.RESET + clanInfo.getEnergyMax());
|
lore.add(C.cYellow + "Max Energy: " + ChatColor.RESET + clanInfo.getEnergyMax());
|
||||||
if (clanInfo.getEnergyCostPerMinute() > 0)
|
if (clanInfo.getEnergyCostPerMinute() > 0) lore.add(C.cYellow + "Time Left: " + ChatColor.RESET + UtilTime.convertString((clanInfo.getEnergy() / clanInfo.getEnergyCostPerMinute()) * 60000L, 1, UtilTime.TimeUnit.FIT));
|
||||||
lore.add(C.cYellow + "Time Left: " + ChatColor.RESET + UtilTime.convertString((clanInfo.getEnergy() / clanInfo.getEnergyCostPerMinute()) * 60000L, 1, UtilTime.TimeUnit.FIT));
|
|
||||||
|
|
||||||
ShopItem shopItem = new ShopItem(Material.DIAMOND, itemName, lore.toArray(new String[0]), 1, false, false);
|
ShopItem shopItem = new ShopItem(Material.DIAMOND, itemName, lore.toArray(new String[0]), 1, false, false);
|
||||||
setItem(slot, shopItem);
|
setItem(slot, shopItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addButton(ClanInfo clanInfo, int slot, int energyAmount, Material material, byte data, String... lore)
|
private void addButton(ClanInfo clanInfo, int slot, int energyAmount, Material material, byte data, String... lore)
|
||||||
{
|
{
|
||||||
boolean locked = energyAmount > clanInfo.getEnergyPurchasable() || energyAmount == 0;
|
boolean locked = energyAmount > clanInfo.getEnergyPurchasable() || energyAmount == 0;
|
||||||
String itemName = "Purchase " + energyAmount + " Energy";
|
String itemName = "Purchase " + energyAmount + " Energy";
|
||||||
|
|
||||||
ShopItem shopItem = new ShopItem(material, itemName, lore, 1, locked, false);
|
ShopItem shopItem = new ShopItem(material, itemName, lore, 1, locked, false);
|
||||||
|
|
||||||
if (locked)
|
if (locked)
|
||||||
setItem(slot, shopItem);
|
setItem(slot, shopItem);
|
||||||
else
|
else
|
||||||
addButton(slot, shopItem, new EnergyShopButton(getPlugin(), this, energyAmount, clanInfo));
|
addButton(slot, shopItem, new EnergyShopButton(getPlugin(), this, energyAmount, clanInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildNoClan()
|
private void buildNoClan()
|
||||||
{
|
{
|
||||||
ShopItem shopItem = new ShopItem(Material.BEDROCK, "No Clan!", new String[] {" ", ChatColor.RESET + "You need to be in a", ChatColor.RESET + "clan to purchase energy!"}, 1, false, false);
|
ShopItem shopItem = new ShopItem(Material.BEDROCK, "No Clan!", new String[] { " ", ChatColor.RESET + "You need to be in a", ChatColor.RESET + "clan to purchase energy!" }, 1, false, false);
|
||||||
setItem(4, shopItem);
|
setItem(4, shopItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class TravelButton implements IButton
|
|||||||
{
|
{
|
||||||
C.cWhite + " ",
|
C.cWhite + " ",
|
||||||
LEFT_CLICK_TRAVEL,
|
LEFT_CLICK_TRAVEL,
|
||||||
C.cWhite + "Costs " + C.cGreen + "$0",
|
C.cWhite + "Costs " + C.cGreen + "0g",
|
||||||
C.cWhite + "Travel to " + C.cGreen + _name + C.cWhite + "!",
|
C.cWhite + "Travel to " + C.cGreen + _name + C.cWhite + "!",
|
||||||
C.cWhite + " ",
|
C.cWhite + " ",
|
||||||
}, 0, false, false);
|
}, 0, false, false);
|
||||||
|
@ -1,11 +1,23 @@
|
|||||||
package mineplex.game.clans.spawn.travel;
|
package mineplex.game.clans.spawn.travel;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.inventory.ClickType;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilBlock;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
|
import mineplex.core.shop.item.IButton;
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
|
import mineplex.game.clans.clans.ClanInfo;
|
||||||
|
import mineplex.game.clans.clans.ClanRole;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.spawn.Spawn;
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
|
|
||||||
@ -13,18 +25,67 @@ public class TravelPage extends ShopPageBase<ClansManager, TravelShop>
|
|||||||
{
|
{
|
||||||
public TravelPage(ClansManager plugin, TravelShop shop, CoreClientManager clientManager, DonationManager donationManager, org.bukkit.entity.Player player)
|
public TravelPage(ClansManager plugin, TravelShop shop, CoreClientManager clientManager, DonationManager donationManager, org.bukkit.entity.Player player)
|
||||||
{
|
{
|
||||||
super(plugin, shop, clientManager, donationManager, "Travel", player, 27);
|
super(plugin, shop, clientManager, donationManager, "Travel", player, 45);
|
||||||
|
|
||||||
buildPage();
|
buildPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void buildPage()
|
protected void buildPage()
|
||||||
{
|
{
|
||||||
addTravelLocation(Spawn.getEastSpawn(), Material.IRON_SWORD, "East Spawn", 14);
|
addTravelLocation(Spawn.getEastSpawn(), Material.IRON_SWORD, "East Spawn", 14 + 10);
|
||||||
addTravelLocation(Spawn.getWestSpawn(), Material.IRON_SWORD, "West Spawn", 12);
|
addTravelLocation(Spawn.getWestSpawn(), Material.IRON_SWORD, "West Spawn", 12 + 8);
|
||||||
addTravelLocation(Spawn.getNorthTown(), Material.EMERALD, "North Town", 4);
|
addTravelLocation(Spawn.getNorthTown(), Material.EMERALD, "North Town", 4);
|
||||||
addTravelLocation(Spawn.getSouthTown(), Material.EMERALD, "South Town", 22);
|
|
||||||
|
final ClanInfo clan = getPlugin().getClan(getPlayer());
|
||||||
|
|
||||||
|
final ItemStack item = new ItemStack(Material.BED, 1);
|
||||||
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
|
||||||
|
if (meta == null)
|
||||||
|
{
|
||||||
|
meta = Bukkit.getItemFactory().getItemMeta(item.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clan == null)
|
||||||
|
{
|
||||||
|
meta.setDisplayName(C.cRed + "Clan Home");
|
||||||
|
meta.setLore(Arrays.asList(C.cGray + "You are not in a Clan."));
|
||||||
|
}
|
||||||
|
else if (clan.getHome() == null)
|
||||||
|
{
|
||||||
|
meta.setDisplayName(C.cRed + "Clan Home");
|
||||||
|
meta.setLore(Arrays.asList(C.cGray + "Your Clan does not have a Home. " + (clan.getMembers().get(getPlayer().getUniqueId()).getRole().equals(ClanRole.ADMIN) || clan.getMembers().get(getPlayer().getUniqueId()).getRole().equals(ClanRole.LEADER) ? C.cGray + "Type /c sethome to set a home" : "Ask your Clan's Leader to set a home.")));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (UtilBlock.isValidBed(clan.getHome()) && clan.getHome().clone().add(0, 1, 0).getBlock().getType().equals(Material.AIR) && clan.getHome().clone().add(0, 2, 0).getBlock().getType().equals(Material.AIR))
|
||||||
|
{
|
||||||
|
meta.setDisplayName(C.cGreen + "Clan Home");
|
||||||
|
meta.setLore(Arrays.asList(C.cGray + "Teleport to your Clan Home."));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
meta.setDisplayName(C.cRed + "Clan Home");
|
||||||
|
meta.setLore(Arrays.asList(C.cGray + "Your Clan's Home Bed has been destroyed, or is obstructed."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
|
||||||
|
addButton(22, item, new IButton()
|
||||||
|
{
|
||||||
|
public void onClick(Player player, ClickType clickType)
|
||||||
|
{
|
||||||
|
if (item.getItemMeta().getDisplayName().startsWith(C.cGreen))
|
||||||
|
{
|
||||||
|
player.closeInventory();
|
||||||
|
player.teleport(clan.getHome().add(0, 1, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addTravelLocation(Spawn.getSouthTown(), Material.EMERALD, "South Town", 22 + 9 + 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTravelLocation(Location location, Material material, String name, int slot)
|
public void addTravelLocation(Location location, Material material, String name, int slot)
|
||||||
|
@ -19,13 +19,13 @@ import mineplex.game.clans.spawn.Spawn;
|
|||||||
|
|
||||||
public class TravelShop extends ShopBase<ClansManager>
|
public class TravelShop extends ShopBase<ClansManager>
|
||||||
{
|
{
|
||||||
public static final String[] TRAVEL_LOCATIONS = {"North Shop", "South Shop", "East Spawn", "West Spawn"};
|
public static final String[] TRAVEL_LOCATIONS = { "North Shop", "South Shop", "East Spawn", "West Spawn" };
|
||||||
|
|
||||||
public TravelShop(ClansManager plugin, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager)
|
public TravelShop(ClansManager plugin, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager)
|
||||||
{
|
{
|
||||||
super(plugin, clientManager, donationManager, "Travel Hub");
|
super(plugin, clientManager, donationManager, "Travel Hub");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ShopPageBase<ClansManager, ? extends ShopBase<ClansManager>> buildPagesFor(Player player)
|
protected ShopPageBase<ClansManager, ? extends ShopBase<ClansManager>> buildPagesFor(Player player)
|
||||||
{
|
{
|
||||||
@ -45,16 +45,19 @@ public class TravelShop extends ShopBase<ClansManager>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy lone instances of Travel buttons that are fetched into a non-shop inventory (via lag)
|
* Destroy lone instances of Travel buttons that are fetched into a non-shop
|
||||||
|
* inventory (via lag)
|
||||||
|
*
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClickedd(InventoryClickEvent event)
|
public void onInventoryClickedd(InventoryClickEvent event)
|
||||||
{
|
{
|
||||||
ItemStack item = event.getCurrentItem();
|
ItemStack item = event.getCurrentItem();
|
||||||
if (item == null || item.getItemMeta() == null || item.getItemMeta().getDisplayName() == null) return;
|
if (item == null || item.getItemMeta() == null || item.getItemMeta().getDisplayName() == null)
|
||||||
|
return;
|
||||||
else if (isPlayerInShop(event.getWhoClicked())) return;
|
else if (isPlayerInShop(event.getWhoClicked())) return;
|
||||||
|
|
||||||
String displayName = event.getCurrentItem().getItemMeta().getDisplayName();
|
String displayName = event.getCurrentItem().getItemMeta().getDisplayName();
|
||||||
for (String travelLocation : TRAVEL_LOCATIONS)
|
for (String travelLocation : TRAVEL_LOCATIONS)
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,6 @@ import mineplex.game.clans.clans.ClansManager;
|
|||||||
import mineplex.game.clans.economy.GoldManager;
|
import mineplex.game.clans.economy.GoldManager;
|
||||||
import mineplex.game.clans.tutorials.commands.SkipTutorialCommand;
|
import mineplex.game.clans.tutorials.commands.SkipTutorialCommand;
|
||||||
import mineplex.game.clans.tutorials.commands.TaskInfoCommand;
|
import mineplex.game.clans.tutorials.commands.TaskInfoCommand;
|
||||||
import mineplex.game.clans.tutorials.types.ClansTips;
|
|
||||||
import mineplex.game.clans.tutorials.types.TutorialGettingStarted;
|
import mineplex.game.clans.tutorials.types.TutorialGettingStarted;
|
||||||
|
|
||||||
public class TutorialManager extends MiniPlugin
|
public class TutorialManager extends MiniPlugin
|
||||||
@ -42,8 +41,6 @@ public class TutorialManager extends MiniPlugin
|
|||||||
_taskManager = taskManager;
|
_taskManager = taskManager;
|
||||||
|
|
||||||
_tutorials.put(TutorialGettingStarted.class, new TutorialGettingStarted(this, clansManager, goldManager, taskManager));
|
_tutorials.put(TutorialGettingStarted.class, new TutorialGettingStarted(this, clansManager, goldManager, taskManager));
|
||||||
|
|
||||||
new ClansTips(this, preferencesManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCommands()
|
public void addCommands()
|
||||||
|
@ -0,0 +1,232 @@
|
|||||||
|
package mineplex.game.clans.tutorials.types;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import mineplex.core.MiniPlugin;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilBlock;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.preferences.PreferencesManager;
|
||||||
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
|
||||||
|
import mineplex.game.clans.clans.event.PlayerEnterTerritoryEvent;
|
||||||
|
import mineplex.game.clans.clans.event.PlayerUnClaimTerritoryEvent;
|
||||||
|
import net.minecraft.server.v1_8_R3.EnumDirection;
|
||||||
|
|
||||||
|
public class ClanTips extends MiniPlugin
|
||||||
|
{
|
||||||
|
private PreferencesManager _preferences;
|
||||||
|
private ClansManager _clans;
|
||||||
|
|
||||||
|
public ClanTips(final JavaPlugin plugin, final ClansManager clans, final PreferencesManager preferences)
|
||||||
|
{
|
||||||
|
super("Clans Tips", plugin);
|
||||||
|
|
||||||
|
_clans = clans;
|
||||||
|
_preferences = preferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEnterTerritory(final PlayerEnterTerritoryEvent event)
|
||||||
|
{
|
||||||
|
if (event.getLastTerritory().equals(event.getNewTerritory()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Player player = event.getPlayer();
|
||||||
|
final String newTerritory = event.getNewTerritory();
|
||||||
|
|
||||||
|
if (_preferences.Get(player).ClanTips)
|
||||||
|
{
|
||||||
|
if (newTerritory.equals("Fields"))
|
||||||
|
{
|
||||||
|
displayTip(TipType.ENTER_FIELDS, player);
|
||||||
|
}
|
||||||
|
else if (newTerritory.equals("Shop"))
|
||||||
|
{
|
||||||
|
displayTip(TipType.ENTER_SHOP, player);
|
||||||
|
}
|
||||||
|
else if (newTerritory.equals("Borderlands"))
|
||||||
|
{
|
||||||
|
displayTip(TipType.ENTER_BORDERLANDS, player);
|
||||||
|
}
|
||||||
|
else if (newTerritory.equals("Spawn"))
|
||||||
|
{
|
||||||
|
displayTip(TipType.ENTER_SPAWN, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onClaimTerritory(final PlayerClaimTerritoryEvent event)
|
||||||
|
{
|
||||||
|
if (event.getClan().getClaimCount() == 0){
|
||||||
|
displayTip(TipType.FIRST_CLAIM_SETHOME, event.getClaimer());
|
||||||
|
|
||||||
|
// Place New
|
||||||
|
boolean bedPlaced = UtilBlock.placeBed(event.getClaimer().getLocation(), BlockFace.valueOf(EnumDirection.fromAngle(event.getClaimer().getLocation().getYaw()).name()), false, false);
|
||||||
|
|
||||||
|
if (!bedPlaced)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(event.getClaimer(), F.main("Clans", "This is not a suitable place for a bed."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cleanup old
|
||||||
|
if (event.getClan().getHome() != null)
|
||||||
|
{
|
||||||
|
System.out.println("<-old bed cleanup-> <--> " + UtilBlock.deleteBed(event.getClan().getHome()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Task
|
||||||
|
_clans.getClanDataAccess().setHome(event.getClan(), event.getClaimer().getLocation(), event.getClaimer().getName());
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
displayTip(TipType.CLAIM, event.getClaimer());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onUnClaimTerritory(final PlayerUnClaimTerritoryEvent event)
|
||||||
|
{
|
||||||
|
displayTip(TipType.UNCLAIM, event.getUnClaimer());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void displayTip(TipType tip, Player player)
|
||||||
|
{
|
||||||
|
if (tip == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_preferences.Get(player).ClanTips)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UtilPlayer.message(player, tip._messages);
|
||||||
|
|
||||||
|
if (!tip._ignorePreferences)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, C.cGray + "(You can disable these Clans Tips in the " + F.elem("/prefs") + " menu.)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static enum TipType
|
||||||
|
{
|
||||||
|
SETHOME(
|
||||||
|
new String[] {
|
||||||
|
C.cDAquaB + "You have set your Clan's Home.",
|
||||||
|
C.cAqua + "You can return to your Clan Home by using " + F.elem("/c home") + ", but remember, you must be in a Safe Spawn location to do this.",
|
||||||
|
C.cAqua + "When you die and respawn, you are also given an option to spawn at your Clan Home."
|
||||||
|
}),
|
||||||
|
|
||||||
|
UNCLAIM(
|
||||||
|
new String[] {
|
||||||
|
C.cDAquaB + "You unclaimed some Clan Territory!",
|
||||||
|
C.cAqua + "When territory is unclaimed, it cannot be reclaimed by anyone for 30 minutes."
|
||||||
|
}),
|
||||||
|
|
||||||
|
CLAIM(
|
||||||
|
new String[] {
|
||||||
|
C.cDAquaB + "You claimed some Clan Territory!",
|
||||||
|
C.cAqua + "Clan Territory is an area of the map that only your Clan is allowed to edit! This means that you can build a base and stash your loot safely inside.",
|
||||||
|
C.cAqua + "Each territory is a 16x16 area, which extends from bedrock to the sky!", C.cGreen + "The borders are marked with glowstone."
|
||||||
|
}),
|
||||||
|
|
||||||
|
ENTER_FIELDS(
|
||||||
|
new String[] {
|
||||||
|
C.cDRedB + "Fields",
|
||||||
|
C.cRed + "Fields is a very lucrative area, filled with ores that periodically respawn over time. This is a great place to get a large amount of resources for your clan; however, be aware of other clans who may also be after the riches buried within the fields."
|
||||||
|
}),
|
||||||
|
|
||||||
|
ENTER_SHOP(
|
||||||
|
new String[] {
|
||||||
|
C.cDGreenB + "Shops",
|
||||||
|
C.cGreen + "Shops is a safe area where combat is disabled between players! Use this safety to purchase food, building blocks, armor, weapons, and other valuable resources. Be careful when leaving though, others may be hiding just outside the gates, eager to steal your recent purchases."
|
||||||
|
}),
|
||||||
|
|
||||||
|
ENTER_BORDERLANDS(
|
||||||
|
new String[] {
|
||||||
|
C.cDRedB + "Borderlands",
|
||||||
|
C.cRed + "The Borderlands are the very outer reaches of the map, out here you can not edit the terrain. Be careful as very powerful boss monsters will periodically spawn out here! Don't try to fight them alone! If you do manage to slay one of these powerful beasts, you'll be handsomely rewarded with powerful gear or legendary weapons."
|
||||||
|
}),
|
||||||
|
|
||||||
|
ENTER_SPAWN(
|
||||||
|
new String[] {
|
||||||
|
C.cDGreenB + "Spawn",
|
||||||
|
C.cGreen + "Spawn is a Safe Zone where you spawn after dying. No one can attack you here, and you cannot attack anyone else. If you have set your Clan Home, you are able to teleport to it from Spawns."
|
||||||
|
}),
|
||||||
|
|
||||||
|
FIRST_CLAIM_SETHOME(
|
||||||
|
new String[] {
|
||||||
|
C.cDAquaB + "First Claim",
|
||||||
|
C.cAqua + "Congratulations on your first Clan Claim.",
|
||||||
|
C.cAqua + "We have automatically placed your Clan Home where you are currently standing.",
|
||||||
|
C.cAqua + "In the future, to set your Clan Home elsewhere, use the " + F.elem("/c sethome") + " command.",
|
||||||
|
C.cAqua + "You can return to your Clan Home by using " + F.elem("/c home") + C.cAqua + ", but remember, you must be in a Safe Spawn location to do this.",
|
||||||
|
C.cAqua + "When you die and respawn, you are also given an option to spawn at your Clan Home."
|
||||||
|
}),
|
||||||
|
|
||||||
|
DOMINANCE_RIP(
|
||||||
|
new String[] {
|
||||||
|
C.cDAquaB + "You died in War!",
|
||||||
|
C.cAqua + "You have just died to a Clan that you are at War with.",
|
||||||
|
C.cAqua + "This means that they have gained a War point.",
|
||||||
|
C.cAqua + "War points indicate how many kills a clan has over you! If it reaches +30 then an invasion starts!",
|
||||||
|
C.cAqua + "During an invasion the clan with +30 has full block access for 15 minutes!",
|
||||||
|
}),
|
||||||
|
|
||||||
|
DOMINANCE_NOOICE(
|
||||||
|
new String[] {
|
||||||
|
C.cDAquaB + "You killed someone at War!",
|
||||||
|
C.cAqua + "You have just killed someone in a Clan that you are at War with.",
|
||||||
|
C.cAqua + "This means that your Clan has gained a War point.",
|
||||||
|
C.cAqua + "War points indicate how many kills you have against a Clan! If it reaches +30 then an invasion starts!",
|
||||||
|
C.cAqua + "During an invasion the clan with +30 has full block access for 15 minutes!",
|
||||||
|
}),
|
||||||
|
|
||||||
|
ENERGY(
|
||||||
|
new String[] {
|
||||||
|
C.cDAquaB + "Energy",
|
||||||
|
C.cAqua + "To top up your energy, go to the Shop and buy some in the Energy Shop.",
|
||||||
|
C.cAqua + "To find the Shop, look at your map (use " + F.elem("/map") + " if you don't have one) and go to either the top-most highlighted area, or the bottom-most highlighted area.",
|
||||||
|
}),
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
// this is only LinkedList because UtilPlayer.message wants it
|
||||||
|
private LinkedList<String> _messages;
|
||||||
|
private boolean _ignorePreferences;
|
||||||
|
|
||||||
|
TipType(String[] messages)
|
||||||
|
{
|
||||||
|
this(messages, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
TipType(String[] messages, boolean ignorePreferences)
|
||||||
|
{
|
||||||
|
_messages = new LinkedList();
|
||||||
|
|
||||||
|
for (String message : messages)
|
||||||
|
{
|
||||||
|
_messages.add(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
_ignorePreferences = ignorePreferences;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,102 +0,0 @@
|
|||||||
package mineplex.game.clans.tutorials.types;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.preferences.PreferencesManager;
|
|
||||||
import mineplex.game.clans.clans.event.DominanceChangeEvent;
|
|
||||||
import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
|
|
||||||
import mineplex.game.clans.clans.event.PlayerEnterTerritoryEvent;
|
|
||||||
import mineplex.game.clans.clans.event.PlayerUnClaimTerritoryEvent;
|
|
||||||
import mineplex.game.clans.tutorials.TutorialManager;
|
|
||||||
|
|
||||||
public class ClansTips extends MiniPlugin
|
|
||||||
{
|
|
||||||
private PreferencesManager _preferences;
|
|
||||||
|
|
||||||
public ClansTips(final TutorialManager manager, final PreferencesManager preferences)
|
|
||||||
{
|
|
||||||
super("Clans Tips", manager.getPlugin());
|
|
||||||
|
|
||||||
_preferences = preferences;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onEnterTerritory(final PlayerEnterTerritoryEvent event)
|
|
||||||
{
|
|
||||||
if (event.getLastTerritory().equals(event.getNewTerritory()))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Player player = event.getPlayer();
|
|
||||||
final String newTerritory = event.getNewTerritory();
|
|
||||||
|
|
||||||
if (_preferences.Get(player).ClanTips)
|
|
||||||
{
|
|
||||||
if (newTerritory.equals("Fields"))
|
|
||||||
{
|
|
||||||
UtilPlayer.message(player, C.cDRedB + "Fields");
|
|
||||||
UtilPlayer.message(player, C.cRed + "Fields is a very lucrative area, filled with ores that periodically respawn over time. This is a great place to get a large amount of resources for your clan; however, be aware of other clans who may also be after the riches buried within the fields.");
|
|
||||||
UtilPlayer.message(player, C.cGray + "(You can disable these Clans Tips in the " + F.elem("/prefs") + " menu.)");
|
|
||||||
}
|
|
||||||
else if (newTerritory.equals("Shop"))
|
|
||||||
{
|
|
||||||
UtilPlayer.message(player, C.cDGreenB + "Shops");
|
|
||||||
UtilPlayer.message(player, C.cGreen + "Shops is a safe area where combat is disabled between players! Use this safety to purchase food, building blocks, armor, weapons, and other valuable resources. Be careful when leaving though, others may be hiding just outside the gates, eager to steal your recent purchases.");
|
|
||||||
UtilPlayer.message(player, C.cGray + "(You can disable these Clans Tips in the " + F.elem("/prefs") + " menu.)");
|
|
||||||
}
|
|
||||||
else if (newTerritory.equals("Borderlands"))
|
|
||||||
{
|
|
||||||
UtilPlayer.message(player, C.cDRedB + "Borderlands");
|
|
||||||
UtilPlayer.message(player, C.cRed + "The Borderlands are the very outer reaches of the map, out here you can not edit the terrain. Be careful as very powerful boss monsters will periodically spawn out here! Don't try to fight them alone! If you do manage to slay one of these powerful beasts, you'll be handsomely rewarded with powerful gear or legendary weapons.");
|
|
||||||
UtilPlayer.message(player, C.cGray + "(You can disable these Clans Tips in the " + F.elem("/prefs") + " menu.)");
|
|
||||||
}
|
|
||||||
else if (newTerritory.equals("Spawn"))
|
|
||||||
{
|
|
||||||
UtilPlayer.message(player, C.cDGreenB + "Spawn");
|
|
||||||
UtilPlayer.message(player, C.cGreen + "Spawn is a Safe Zone where you spawn after dying. No one can attack you here, and you cannot attack anyone else. If you have set your Clan Home, you are able to teleport to it from Spawns.");
|
|
||||||
UtilPlayer.message(player, C.cGray + "(You can disable these Clans Tips in the " + F.elem("/prefs") + " menu.)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onClaimTerritory(final PlayerClaimTerritoryEvent event)
|
|
||||||
{
|
|
||||||
final Player player = event.getClaimer();
|
|
||||||
|
|
||||||
if (_preferences.Get(player).ClanTips)
|
|
||||||
{
|
|
||||||
UtilPlayer.message(player, C.cDGreenB + "You claimed some Clan Territory!");
|
|
||||||
UtilPlayer.message(player, C.cGreen + "Clan Territory is an area of the map that only your Clan is allowed to edit! This means that you can build a base and stash your loot safely inside.");
|
|
||||||
UtilPlayer.message(player, C.cGreen + "Each territory is a 16x16 area, which extends from bedrock to the sky!");
|
|
||||||
UtilPlayer.message(player, C.cGreen + "The borders are marked with glowstone.");
|
|
||||||
UtilPlayer.message(player, C.cGray + "(You can disable these Clans Tips in the " + F.elem("/prefs") + " menu.)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onUnClaimTerritory(final PlayerUnClaimTerritoryEvent event)
|
|
||||||
{
|
|
||||||
final Player player = event.getUnClaimer();
|
|
||||||
|
|
||||||
if (_preferences.Get(player).ClanTips)
|
|
||||||
{
|
|
||||||
UtilPlayer.message(player, C.cDGreenB + "You unclaimed some Clan Territory!");
|
|
||||||
UtilPlayer.message(player, C.cGreen + "When territory is unclaimed, it cannot be reclaimed by anyone for 30 minutes.");
|
|
||||||
UtilPlayer.message(player, C.cGray + "(You can disable these Clans Tips in the " + F.elem("/prefs") + " menu.)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onDominanceChange(final DominanceChangeEvent event)
|
|
||||||
{
|
|
||||||
// TODO: pls remember ben
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user