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.COAL_ORE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.ORE, ItemCategory.IRON));
|
||||
_materials.put(Material.LOG, EnumSet.of(ItemCategory.BLOCK, ItemCategory.WOOD));
|
||||
_materials.put(Material.LEAVES, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.LOG, EnumSet.of(ItemCategory.BLOCK, ItemCategory.WOOD, ItemCategory.LOG));
|
||||
_materials.put(Material.LEAVES, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.LEAVES));
|
||||
_materials.put(Material.SPONGE, EnumSet.of(ItemCategory.BLOCK));
|
||||
_materials.put(Material.GLASS, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.GLASS));
|
||||
_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.STAINED_CLAY, EnumSet.of(ItemCategory.BLOCK));
|
||||
_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.LOG_2, EnumSet.of(ItemCategory.BLOCK, ItemCategory.WOOD));
|
||||
_materials.put(Material.LEAVES_2, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.LEAVES));
|
||||
_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.DARK_OAK_STAIRS, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.HAY_BLOCK, EnumSet.of(ItemCategory.BLOCK));
|
||||
@ -808,6 +808,26 @@ public class UtilItem
|
||||
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)
|
||||
{
|
||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.TOOL));
|
||||
@ -970,7 +990,9 @@ public class UtilItem
|
||||
HOE,
|
||||
ITEM,
|
||||
BLOCK,
|
||||
ITEM_BLOCK;
|
||||
ITEM_BLOCK,
|
||||
LOG,
|
||||
LEAVES;
|
||||
}
|
||||
|
||||
public enum ArmorMaterial
|
||||
|
@ -17,6 +17,7 @@ public enum UpdateType
|
||||
MIN_01(60000),
|
||||
SLOWEST(32000),
|
||||
SLOWER(16000),
|
||||
SEC_08(8000),
|
||||
SLOW(4000),
|
||||
TWOSEC(2000),
|
||||
SEC(1000),
|
||||
|
@ -49,65 +49,64 @@ public class Clans extends JavaPlugin
|
||||
{
|
||||
public static final String VERSION = "0.12";
|
||||
private String WEB_CONFIG = "webServer";
|
||||
|
||||
//Modules
|
||||
|
||||
// Modules
|
||||
private CoreClientManager _clientManager;
|
||||
private DonationManager _donationManager;
|
||||
private ClansManager _clansManager;
|
||||
|
||||
|
||||
@Override
|
||||
public void onEnable()
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
//Configs
|
||||
// Configs
|
||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
||||
saveConfig();
|
||||
|
||||
String webServerAddress = getConfig().getString(WEB_CONFIG);
|
||||
|
||||
//Logger.initialize(this);
|
||||
|
||||
//Static Modules
|
||||
CommandCenter.Initialize(this);
|
||||
|
||||
// Logger.initialize(this);
|
||||
|
||||
// Static Modules
|
||||
CommandCenter.Initialize(this);
|
||||
_clientManager = new CoreClientManager(this, webServerAddress);
|
||||
CommandCenter.Instance.setClientManager(_clientManager);
|
||||
|
||||
ItemStackFactory.Initialize(this, false);
|
||||
|
||||
ItemStackFactory.Initialize(this, false);
|
||||
|
||||
Recharge.Initialize(this);
|
||||
VisibilityManager.Initialize(this);
|
||||
// new ProfileCacheManager(this);
|
||||
|
||||
// new ProfileCacheManager(this);
|
||||
|
||||
_donationManager = new DonationManager(this, _clientManager, webServerAddress);
|
||||
|
||||
new ServerConfiguration(this, _clientManager);
|
||||
|
||||
PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager);
|
||||
|
||||
|
||||
ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager));
|
||||
|
||||
// TODO: Add spawn locations to a configuration file of some sort?
|
||||
new Spawn(this, serverStatusManager.getCurrentServerName());
|
||||
Give.Initialize(this);
|
||||
|
||||
|
||||
Teleport teleport = new Teleport(this);
|
||||
Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName());
|
||||
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
|
||||
|
||||
|
||||
Punish punish = new Punish(this, webServerAddress, _clientManager);
|
||||
AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager);
|
||||
AntiHack.Instance.setKick(false);
|
||||
|
||||
|
||||
BlockRestore blockRestore = new BlockRestore(this);
|
||||
|
||||
|
||||
IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal);
|
||||
|
||||
|
||||
StatsManager statsManager = new StatsManager(this, _clientManager);
|
||||
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager);
|
||||
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 MemoryFix(this);
|
||||
new FoodDupeFix(this);
|
||||
new Explosion(this, blockRestore);
|
||||
@ -117,7 +116,7 @@ public class Clans extends JavaPlugin
|
||||
// Enable custom-gear related managers
|
||||
PacketHandler packetHandler = new PacketHandler(this);
|
||||
GearManager customGear = new GearManager(this, packetHandler, _clientManager, _donationManager);
|
||||
|
||||
|
||||
HologramManager hologram = new HologramManager(this);
|
||||
_clansManager = new ClansManager(this, serverStatusManager.getCurrentServerName(), packetHandler, _clientManager, _donationManager, preferenceManager, blockRestore, teleport, chat, customGear, hologram, webServerAddress);
|
||||
new Recipes(this);
|
||||
@ -135,14 +134,14 @@ public class Clans extends JavaPlugin
|
||||
((CraftWorld) world).getHandle().spigotConfig.itemMerge = 0;
|
||||
}
|
||||
|
||||
//Updates
|
||||
// Updates
|
||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
||||
|
||||
MinecraftServer.getServer().getPropertyManager().setProperty("debug", true);
|
||||
|
||||
getServer().setWhitelist(false); // TODO: remove
|
||||
}
|
||||
|
||||
|
||||
public static String prettifyName(Material material)
|
||||
{
|
||||
String name = "";
|
||||
@ -156,11 +155,12 @@ public class Clans extends JavaPlugin
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.tutorials.types.ClanTips.TipType;
|
||||
|
||||
public class ClanEnergyTracker extends MiniPlugin
|
||||
{
|
||||
@ -63,7 +64,7 @@ public class ClanEnergyTracker extends MiniPlugin
|
||||
if (energyBounds != null && energyRemaining > energyBounds.getLeft() && energyRemaining < energyBounds.getMiddle())
|
||||
{
|
||||
_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
|
||||
Clans.getClanDataAccess().home(clan, caller.getLocation(), caller.getName());
|
||||
Clans.getClanDataAccess().setHome(clan, caller.getLocation(), caller.getName());
|
||||
|
||||
//Inform
|
||||
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 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;
|
||||
|
||||
|
@ -591,7 +591,7 @@ public class ClansDataAccessLayer
|
||||
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
|
||||
clan.setHome(loc);
|
||||
|
@ -2,6 +2,7 @@ package mineplex.game.clans.clans;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -22,11 +23,13 @@ import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
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.ActionType;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
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.core.repository.ClanTerritory;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
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));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void respawn(PlayerRespawnEvent event){
|
||||
_clans.getItemMapManager().setMap(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void Damage(CustomDamageEvent event)
|
||||
{
|
||||
@ -482,10 +494,12 @@ public class ClansGame extends MiniPlugin
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void TURTLEZ(PlayerCommandPreprocessEvent event){
|
||||
if (event.getPlayer().getName().equals("SamitoD") && event.getMessage().equals("/gear")){
|
||||
public void TURTLEZ(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (event.getPlayer().getName().equals("SamitoD") && event.getMessage().equals("/gear"))
|
||||
{
|
||||
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."));
|
||||
}
|
||||
}
|
||||
|
||||
@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.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
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.loot.LootManager;
|
||||
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.redis.ClanDeleteCommandHandler;
|
||||
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.items.GearManager;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.game.clans.spawn.travel.TravelShop;
|
||||
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.ClientClass;
|
||||
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.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 WORLD_RADIUS = 1200;
|
||||
private static final TimeZone TIME_ZONE = TimeZone.getDefault();
|
||||
private static ClansManager _instance;
|
||||
public static ClansManager getInstance() { return _instance; }
|
||||
|
||||
|
||||
public static ClansManager getInstance()
|
||||
{
|
||||
return _instance;
|
||||
}
|
||||
|
||||
private String _serverName;
|
||||
|
||||
|
||||
private CoreClientManager _clientManager;
|
||||
private CombatManager _combatManager;
|
||||
private ClansUtility _clanUtility;
|
||||
@ -136,12 +141,17 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
private HologramManager _hologramManager;
|
||||
private GearManager _gearManager;
|
||||
private LootManager _lootManager;
|
||||
private DonationManager _donationManager;
|
||||
|
||||
private TutorialManager _tutorialManager;
|
||||
|
||||
private ClassManager _classManager;
|
||||
public ClassManager getClassManager() { return _classManager; }
|
||||
|
||||
|
||||
public ClassManager getClassManager()
|
||||
{
|
||||
return _classManager;
|
||||
}
|
||||
|
||||
private WarManager _warManager;
|
||||
private ProjectileManager _projectileManager;
|
||||
private WorldEventManager _worldEvent;
|
||||
@ -151,42 +161,48 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
private NpcManager _npcManager;
|
||||
private Explosion _explosion;
|
||||
private GoldManager _goldManager;
|
||||
|
||||
|
||||
private int _inviteExpire = 2;
|
||||
private int _nameMin = 3;
|
||||
private int _nameMax = 10;
|
||||
private long _reclaimTime = 1800000;
|
||||
private long _onlineTime = 1200000;
|
||||
|
||||
|
||||
// Command Shop
|
||||
private ClanShop _clanShop;
|
||||
|
||||
//Clans
|
||||
|
||||
// Clans
|
||||
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<String, ClanTerritory> _claimMap = new NautHashMap<String, ClanTerritory>();
|
||||
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 ClanTips ClanTips;
|
||||
|
||||
// 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)
|
||||
{
|
||||
super("Clans Manager", plugin);
|
||||
|
||||
|
||||
_instance = this;
|
||||
|
||||
_serverName = serverName;
|
||||
_clientManager = clientManager;
|
||||
_combatManager = new CombatManager(plugin);
|
||||
_hologramManager = hologramManager;
|
||||
|
||||
|
||||
_chat = chat;
|
||||
_blockRestore = blockRestore;
|
||||
_teleport = teleport;
|
||||
_warManager = new WarManager(plugin, this);
|
||||
|
||||
|
||||
_donationManager = donationManager;
|
||||
|
||||
_goldManager = new GoldManager(this, _clientManager, donationManager);
|
||||
_gearManager = gearManager;
|
||||
_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);
|
||||
|
||||
ClanTips = new ClanTips(plugin, this, preferencesManager);
|
||||
|
||||
_scoreboard = new ClansScoreboardManager(plugin, _tutorialManager, this, _warManager, _worldEvent, clientManager, donationManager);
|
||||
// new MurderManager(plugin, this);
|
||||
// new MurderManager(plugin, this);
|
||||
|
||||
_clanAdmin = new ClansAdmin(this);
|
||||
_clanBlocks = new ClansBlocks();
|
||||
@ -213,19 +231,19 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
_itemMapManager = new ItemMapManager(this, _worldEvent);
|
||||
new TntGeneratorManager(plugin, this);
|
||||
new SupplyDropManager(plugin, this);
|
||||
|
||||
|
||||
_explosion = new Explosion(plugin, blockRestore);
|
||||
|
||||
// new ClansLoginManager(getPlugin(), clientManager, _serverName);
|
||||
|
||||
|
||||
// new ClansLoginManager(getPlugin(), clientManager, _serverName);
|
||||
|
||||
_clanShop = new ClanShop(this, clientManager, donationManager);
|
||||
|
||||
|
||||
Energy energy = new Energy(plugin);
|
||||
// TODO: Re-enable customtagfix with NCP update?
|
||||
//new CustomTagFix(plugin, packetHandler);
|
||||
|
||||
// new CustomTagFix(plugin, packetHandler);
|
||||
|
||||
new Field(plugin, creature, _condition, this, energy, serverName);
|
||||
|
||||
|
||||
// Required managers to be initialized
|
||||
new Spawn(plugin, this);
|
||||
new NPCManager(this, _hologramManager);
|
||||
@ -240,11 +258,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
new Gameplay(plugin, this, blockRestore, damageManager);
|
||||
_projectileManager = new ProjectileManager(plugin);
|
||||
Fire fire = new Fire(plugin, _condition, damageManager);
|
||||
|
||||
|
||||
HashSet<String> itemIgnore = new HashSet<String>();
|
||||
itemIgnore.add("Proximity Explosive");
|
||||
itemIgnore.add("Proximity Zapper");
|
||||
|
||||
|
||||
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);
|
||||
skillManager.RemoveSkill("Dwarf Toss", "Block Toss");
|
||||
@ -257,37 +275,39 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
// Register redis based server commands
|
||||
ServerCommandManager.getInstance().registerCommandType(ClanDeleteCommand.class, new ClanDeleteCommandHandler());
|
||||
ServerCommandManager.getInstance().registerCommandType(ClanLoadCommand.class, new ClanLoadCommandHandler());
|
||||
|
||||
|
||||
StatsManager statsManager = new StatsManager(plugin, _clientManager);
|
||||
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager);
|
||||
ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager);
|
||||
_classShop = new ClassCombatShop(shopManager, _clientManager, donationManager, true, "Class Shop");
|
||||
|
||||
|
||||
ClanEnergyManager clanEnergyManager = new ClanEnergyManager(plugin, this, clientManager, donationManager);
|
||||
|
||||
|
||||
for (ClanToken token : _clanDataAccess.getRepository().retrieveClans())
|
||||
{
|
||||
loadClan(token);
|
||||
}
|
||||
|
||||
//RedisDataRepository(ConnectionData writeConn, ConnectionData readConn, Region region, Class<T> elementType, String elementLabel)
|
||||
// Initialize default region factions and territory (spawn/fields/borderlands)
|
||||
|
||||
// RedisDataRepository(ConnectionData writeConn, ConnectionData
|
||||
// readConn, Region region, Class<T> elementType, String elementLabel)
|
||||
// Initialize default region factions and territory
|
||||
// (spawn/fields/borderlands)
|
||||
_clanRegions = new ClansRegions(plugin, this);
|
||||
_clanRegions.initializeRegions();
|
||||
|
||||
// Disables beds from being crafted
|
||||
Iterator<Recipe> it = _plugin.getServer().recipeIterator();
|
||||
Recipe recipe;
|
||||
while(it.hasNext())
|
||||
{
|
||||
recipe = it.next();
|
||||
if (recipe != null && recipe.getResult().getType() == Material.BED)
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
Recipe recipe;
|
||||
while (it.hasNext())
|
||||
{
|
||||
recipe = it.next();
|
||||
if (recipe != null && recipe.getResult().getType() == Material.BED)
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addCommands()
|
||||
{
|
||||
@ -298,136 +318,140 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
addCommand(new ClanManagementCommand(this));
|
||||
addCommand(new MapCommand(this));
|
||||
}
|
||||
|
||||
|
||||
public void loadClan(ClanToken clanToken)
|
||||
{
|
||||
ClanInfo clan = new ClanInfo(this, clanToken);
|
||||
_clanMap.put(clanToken.Name, clan);
|
||||
|
||||
|
||||
for (ClanMemberToken memberToken : clanToken.Members)
|
||||
{
|
||||
_clanMemberUuidMap.put(memberToken.PlayerUUID, clan);
|
||||
// _clanMemberMap.put(memberToken.Name, clan);
|
||||
// _clanMemberMap.put(memberToken.Name, clan);
|
||||
}
|
||||
|
||||
|
||||
for (ClanTerritoryToken territoryToken : clanToken.Territories)
|
||||
_claimMap.put(territoryToken.Chunk, new ClanTerritory(territoryToken));
|
||||
}
|
||||
|
||||
|
||||
public DisguiseManager getDisguiseManager()
|
||||
{
|
||||
return _disguiseManager;
|
||||
}
|
||||
|
||||
|
||||
public NpcManager getNPCManager()
|
||||
{
|
||||
return _npcManager;
|
||||
}
|
||||
|
||||
|
||||
public ClansRegions getClanRegions()
|
||||
{
|
||||
return _clanRegions;
|
||||
}
|
||||
|
||||
|
||||
public DonationManager getDonationManager()
|
||||
{
|
||||
return _donationManager;
|
||||
}
|
||||
|
||||
public ItemMapManager getItemMapManager()
|
||||
{
|
||||
return _itemMapManager;
|
||||
}
|
||||
|
||||
|
||||
public Explosion getExplosion()
|
||||
{
|
||||
return _explosion;
|
||||
}
|
||||
|
||||
|
||||
public int getInviteExpire()
|
||||
{
|
||||
return _inviteExpire;
|
||||
}
|
||||
|
||||
|
||||
public NautHashMap<String, ClanInfo> getClanMap()
|
||||
{
|
||||
return _clanMap;
|
||||
}
|
||||
|
||||
|
||||
public Set<String> getClanNameSet()
|
||||
{
|
||||
return _clanMap.keySet();
|
||||
}
|
||||
|
||||
|
||||
public NautHashMap<UUID, ClanInfo> getClanMemberUuidMap()
|
||||
{
|
||||
return _clanMemberUuidMap;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isClaimable(Location location)
|
||||
{
|
||||
int x = Math.abs(location.getBlockX());
|
||||
int z = Math.abs(location.getBlockZ());
|
||||
|
||||
return (x <= CLAIMABLE_RADIUS && z <= CLAIMABLE_RADIUS)
|
||||
&& !Spawn.getInstance().isInSpawn(location);
|
||||
|
||||
return (x <= CLAIMABLE_RADIUS && z <= CLAIMABLE_RADIUS) && !Spawn.getInstance().isInSpawn(location);
|
||||
}
|
||||
|
||||
|
||||
public boolean isFields(Location location)
|
||||
{
|
||||
return getClanUtility().isSpecial(location, "Fields");
|
||||
}
|
||||
|
||||
|
||||
public boolean canUnclaimChunk(ClanInfo stealer, ClanInfo owner)
|
||||
{
|
||||
return owner.getClaims() > owner.getClaimsMax()
|
||||
&& !owner.isAdmin() && !owner.isAlly(stealer);
|
||||
return owner.getClaims() > owner.getClaimsMax() && !owner.isAdmin() && !owner.isAlly(stealer);
|
||||
}
|
||||
|
||||
|
||||
public ClanInfo getClan(Player player)
|
||||
{
|
||||
return _clanMemberUuidMap.get(player.getUniqueId());
|
||||
}
|
||||
|
||||
|
||||
public boolean isInClan(Player player)
|
||||
{
|
||||
return _clanMemberUuidMap.containsKey(player.getUniqueId());
|
||||
}
|
||||
|
||||
|
||||
public ClanInfo getClan(String clan)
|
||||
{
|
||||
return _clanMap.get(clan);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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)
|
||||
{
|
||||
return getClan(clanName) != null;
|
||||
}
|
||||
|
||||
|
||||
public NautHashMap<String, ClanTerritory> getClaimMap()
|
||||
{
|
||||
return _claimMap;
|
||||
}
|
||||
|
||||
|
||||
public long lastPower = System.currentTimeMillis();
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void savePlayerActiveBuild(PlayerQuitEvent event)
|
||||
{
|
||||
if (_classManager.Get(event.getPlayer()) != null && _classManager.Get(event.getPlayer()).GetGameClass() != null)
|
||||
{
|
||||
CustomBuildToken activeBuild = _classManager.Get(event.getPlayer()).GetActiveCustomBuild(_classManager.Get(event.getPlayer()).GetGameClass());
|
||||
|
||||
if (activeBuild == null)
|
||||
return;
|
||||
|
||||
|
||||
if (activeBuild == null) return;
|
||||
|
||||
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;
|
||||
_classManager.GetRepository().SaveCustomBuild(activeBuild);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
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)
|
||||
{
|
||||
ItemStack item = event.getPlayer().getItemInHand();
|
||||
if (item != null && item.getType() == Material.ENDER_PEARL)
|
||||
event.setCancelled(true);
|
||||
if (item != null && item.getType() == Material.ENDER_PEARL) event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void BlockCreatureSpawn(CreatureSpawnCustomEvent event)
|
||||
{
|
||||
ClanInfo clan = _clanUtility.getOwner(event.GetLocation());
|
||||
|
||||
if (clan != null && !clan.isAdmin()
|
||||
&& !clan.getName().equals("Spawn") && event.getReason() != SpawnReason.CUSTOM)
|
||||
|
||||
if (clan != null && !clan.isAdmin() && !clan.getName().equals("Spawn") && event.getReason() != SpawnReason.CUSTOM)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void Interact(PlayerInteractEvent event)
|
||||
{
|
||||
getClanGame().Interact(event);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void join(PlayerJoinEvent event)
|
||||
{
|
||||
@ -480,7 +502,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
clanInfo.playerOnline(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void denyBow(EntityShootBowEvent event)
|
||||
{
|
||||
@ -495,7 +517,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void quit(PlayerQuitEvent event)
|
||||
{
|
||||
@ -506,32 +528,29 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
clanInfo.playerOffline(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void handlePlayerChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
ClientClan client = Get(event.getPlayer());
|
||||
|
||||
if (client == null)
|
||||
return;
|
||||
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
ClientClan client = Get(event.getPlayer());
|
||||
|
||||
if (client == null) return;
|
||||
|
||||
ClanInfo clan = _clanUtility.getClanByPlayer(event.getPlayer());
|
||||
|
||||
|
||||
if (client.isClanChat() && clan != null)
|
||||
{
|
||||
event.setFormat(C.cAqua + "%1$s " + C.cDAqua + "%2$s");
|
||||
event.getRecipients().clear();
|
||||
|
||||
|
||||
for (ClansPlayer cur : clan.getMembers().values())
|
||||
{
|
||||
Player player = UtilPlayer.searchExact(cur.getUuid());
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
|
||||
if (player == null) continue;
|
||||
|
||||
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.getRecipients().clear();
|
||||
|
||||
|
||||
for (ClansPlayer cur : clan.getMembers().values())
|
||||
{
|
||||
Player player = UtilPlayer.searchExact(cur.getUuid());
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
|
||||
if (player == null) continue;
|
||||
|
||||
event.getRecipients().add(player);
|
||||
}
|
||||
|
||||
|
||||
for (String allyName : clan.getAllyMap().keySet())
|
||||
{
|
||||
ClanInfo ally = _clanUtility.getClanByClanName(allyName);
|
||||
if (ally == null) continue;
|
||||
|
||||
if (ally == null) continue;
|
||||
|
||||
for (ClansPlayer cur : ally.getMembers().values())
|
||||
{
|
||||
Player player = UtilPlayer.searchExact(cur.getUuid());
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
|
||||
if (player == null) continue;
|
||||
|
||||
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");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
event.getRecipients().clear();
|
||||
event.setFormat(C.cGold + clan.getName() + " " + C.cYellow + "%1$s " + C.cWhite + "%2$s");
|
||||
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
ClanInfo otherClan = _clanUtility.getClanByPlayer(other);
|
||||
|
||||
|
||||
if (otherClan == null)
|
||||
{
|
||||
event.getRecipients().add(other);
|
||||
@ -590,243 +607,255 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
String message = event.getMessage();
|
||||
message = _chat.getFilteredMessage(event.getPlayer(), message);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
for (Player player : clan.getOnlinePlayers())
|
||||
{
|
||||
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)
|
||||
{
|
||||
middleTextClan(clan, header, footer, 20, 60, 20);
|
||||
}
|
||||
|
||||
|
||||
public void middleTextClan(ClanInfo clan, String header, String footer, int fadeInTicks, int stayTicks, int fadeOutTicks)
|
||||
{
|
||||
UtilTextMiddle.display(header, footer, fadeInTicks, stayTicks, fadeOutTicks, clan.getOnlinePlayersArray());
|
||||
}
|
||||
|
||||
|
||||
public void chatClan(ClanInfo clan, Player caller, String message)
|
||||
{
|
||||
messageClan(clan, C.cAqua + caller.getName() + " " + C.cDAqua + message);
|
||||
}
|
||||
|
||||
|
||||
public void chatAlly(ClanInfo clan, Player caller, String message)
|
||||
{
|
||||
String sendMessage = C.cDGreen + clan.getName() + " " + C.cDGreen + caller.getName() + " " + C.cGreen + message;
|
||||
|
||||
|
||||
messageClan(clan, sendMessage);
|
||||
|
||||
|
||||
for (String allyName : clan.getAllyMap().keySet())
|
||||
{
|
||||
ClanInfo ally = _clanUtility.getClanByClanName(allyName);
|
||||
if (ally == null) continue;
|
||||
|
||||
if (ally == null) continue;
|
||||
|
||||
messageClan(ally, sendMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getNameMin()
|
||||
{
|
||||
return _nameMin;
|
||||
}
|
||||
|
||||
|
||||
public int getNameMax()
|
||||
{
|
||||
return _nameMax;
|
||||
}
|
||||
|
||||
|
||||
public long getReclaimTime()
|
||||
{
|
||||
return _reclaimTime;
|
||||
}
|
||||
|
||||
|
||||
public boolean canHurt(Player a, Player b)
|
||||
{
|
||||
if (a.equals(b))
|
||||
return false;
|
||||
|
||||
if (a.equals(b)) return false;
|
||||
|
||||
return _clanUtility.canHurt(a, b);
|
||||
}
|
||||
|
||||
|
||||
public boolean canHurt(String a, String b)
|
||||
{
|
||||
if (a.equals(b))
|
||||
return false;
|
||||
|
||||
if (a.equals(b)) return false;
|
||||
|
||||
return _clanUtility.canHurt(UtilPlayer.searchExact(a), UtilPlayer.searchExact(b));
|
||||
}
|
||||
|
||||
|
||||
public boolean isSafe(Player a)
|
||||
{
|
||||
return _clanUtility.isSafe(a);
|
||||
}
|
||||
|
||||
// public ClanRelation getRelation(String playerA, String playerB)
|
||||
// {
|
||||
// return getClanUtility().rel(_clanMemberMap.get(playerA), _clanMemberMap.get(playerB));
|
||||
// }
|
||||
|
||||
|
||||
// public ClanRelation getRelation(String playerA, String playerB)
|
||||
// {
|
||||
// return getClanUtility().rel(_clanMemberMap.get(playerA),
|
||||
// _clanMemberMap.get(playerB));
|
||||
// }
|
||||
|
||||
public ClanRelation getRelation(Player playerA, Player playerB)
|
||||
{
|
||||
return getRelation(playerA.getUniqueId(), playerB.getUniqueId());
|
||||
}
|
||||
|
||||
|
||||
public ClanRelation getRelation(UUID playerA, UUID playerB)
|
||||
{
|
||||
return getClanUtility().rel(getClanMemberUuidMap().get(playerA), getClanMemberUuidMap().get(playerB));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public long getOnlineTime()
|
||||
{
|
||||
return _onlineTime;
|
||||
}
|
||||
|
||||
|
||||
public CombatManager getCombatManager()
|
||||
{
|
||||
return _combatManager;
|
||||
}
|
||||
|
||||
|
||||
public ClansUtility getClanUtility()
|
||||
{
|
||||
return _clanUtility;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected ClientClan AddPlayer(String player)
|
||||
{
|
||||
return new ClientClan();
|
||||
}
|
||||
|
||||
|
||||
public BlockRestore getBlockRestore()
|
||||
{
|
||||
return _blockRestore;
|
||||
}
|
||||
|
||||
|
||||
public ClansDataAccessLayer getClanDataAccess()
|
||||
{
|
||||
return _clanDataAccess;
|
||||
}
|
||||
|
||||
|
||||
public Teleport getTeleport()
|
||||
{
|
||||
return _teleport;
|
||||
}
|
||||
|
||||
|
||||
public ClansDisplay getClanDisplay()
|
||||
{
|
||||
return _clanDisplay;
|
||||
}
|
||||
|
||||
|
||||
public NautHashMap<String, Long> getUnclaimMap()
|
||||
{
|
||||
return _unclaimMap;
|
||||
}
|
||||
|
||||
|
||||
public ClansAdmin getClanAdmin()
|
||||
{
|
||||
return _clanAdmin;
|
||||
}
|
||||
|
||||
|
||||
public ClansGame getClanGame()
|
||||
{
|
||||
return _clanGame;
|
||||
}
|
||||
|
||||
|
||||
public ClansBlocks getClanBlocks()
|
||||
{
|
||||
return _clanBlocks;
|
||||
}
|
||||
|
||||
|
||||
public String getServerName()
|
||||
{
|
||||
return _serverName;
|
||||
}
|
||||
|
||||
|
||||
public CoreClientManager getClientManager()
|
||||
{
|
||||
return _clientManager;
|
||||
}
|
||||
|
||||
|
||||
public ConditionManager getCondition()
|
||||
{
|
||||
return _condition;
|
||||
}
|
||||
|
||||
|
||||
public ClassCombatShop getClassShop()
|
||||
{
|
||||
return _classShop;
|
||||
}
|
||||
|
||||
|
||||
public ClanShop getClanShop()
|
||||
{
|
||||
return _clanShop;
|
||||
}
|
||||
|
||||
|
||||
public WarManager getWarManager()
|
||||
{
|
||||
return _warManager;
|
||||
}
|
||||
|
||||
|
||||
public ProjectileManager getProjectile()
|
||||
{
|
||||
return _projectileManager;
|
||||
}
|
||||
|
||||
|
||||
public WorldEventManager getWorldEvent()
|
||||
{
|
||||
return _worldEvent;
|
||||
}
|
||||
|
||||
|
||||
public HologramManager getHologramManager()
|
||||
{
|
||||
return _hologramManager;
|
||||
}
|
||||
|
||||
|
||||
public GearManager getGearManager()
|
||||
{
|
||||
return _gearManager;
|
||||
}
|
||||
|
||||
|
||||
public LootManager getLootManager()
|
||||
{
|
||||
return _lootManager;
|
||||
}
|
||||
|
||||
|
||||
public Chat getChat()
|
||||
{
|
||||
return _chat;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the timezone for this server.
|
||||
* This may be used in the future if we have
|
||||
* clans servers with varying timezones.
|
||||
* Get the timezone for this server. This may be used in the future if we
|
||||
* have clans servers with varying timezones.
|
||||
*
|
||||
* @return {@link java.util.TimeZone} that this server should run at
|
||||
*/
|
||||
public TimeZone getServerTimeZone()
|
||||
{
|
||||
return TIME_ZONE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void disable()
|
||||
{
|
||||
// Kind of confusing, Clans.java calls this so that we can pass the disable event to WorldEventManager
|
||||
// This is so that we can prevent any permanent world changes with events
|
||||
// Kind of confusing, Clans.java calls this so that we can pass the
|
||||
// disable event to WorldEventManager
|
||||
// This is so that we can prevent any permanent world changes with
|
||||
// events
|
||||
_blockRestore.onDisable();
|
||||
_worldEvent.onDisable();
|
||||
_goldManager.onDisable();
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
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())
|
||||
{
|
||||
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!");
|
||||
}
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void openShop(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
@ -853,24 +882,24 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void handleClansDeath(PlayerDeathEvent event)
|
||||
{
|
||||
PlayerClan playerClan;
|
||||
PlayerClan killerClan = null;
|
||||
|
||||
|
||||
Player player = event.getEntity();
|
||||
ClanInfo pClan = _clanMemberUuidMap.get(player.getUniqueId());
|
||||
playerClan = new PlayerClan(player, pClan);
|
||||
|
||||
|
||||
if (player.getKiller() != null)
|
||||
{
|
||||
Player killer = player.getKiller();
|
||||
ClanInfo kClan = _clanMemberUuidMap.get(killer.getUniqueId());
|
||||
killerClan = new PlayerClan(killer, kClan);
|
||||
}
|
||||
|
||||
|
||||
ClansPlayerDeathEvent clansPlayerDeathEvent = new ClansPlayerDeathEvent(event, playerClan, killerClan);
|
||||
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.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
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.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.game.clans.clans.ClanInfo;
|
||||
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.event.ClansCommandExecutedEvent;
|
||||
import mineplex.game.clans.tutorials.TutorialManager;
|
||||
import mineplex.game.clans.tutorials.types.ClanTips.TipType;
|
||||
import net.minecraft.server.v1_8_R3.EnumDirection;
|
||||
|
||||
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);
|
||||
|
||||
|
||||
_manager.getClanUtility().kick(caller, target);
|
||||
}
|
||||
|
||||
public void promote(Player caller, String[] args)
|
||||
{
|
||||
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
||||
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input player to promote."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
final String targetName = UtilPlayer.searchCollection(caller, args[1], clan.getMemberNameSet(), "Clan Member", true);
|
||||
|
||||
|
||||
_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);
|
||||
|
||||
|
||||
_manager.getClanUtility().demote(caller, targetName);
|
||||
}
|
||||
|
||||
@ -735,7 +736,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -759,7 +760,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
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."));
|
||||
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
|
||||
Plugin.getTeleport().TP(caller, clan.getHome());
|
||||
Plugin.getTeleport().TP(caller, clan.getHome().add(0, 1, 0));
|
||||
|
||||
// Inform
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
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)
|
||||
{
|
||||
@ -824,11 +832,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
// Cleanup old
|
||||
if (clan.getHome() != null)
|
||||
{
|
||||
System.out.println("OLD CLEANUP: " + UtilBlock.deleteBed(clan.getHome()));
|
||||
System.out.println("<-old bed cleanup-> <--> " + UtilBlock.deleteBed(clan.getHome()));
|
||||
}
|
||||
|
||||
// Task
|
||||
Plugin.getClanDataAccess().home(clan, caller.getLocation(), caller.getName());
|
||||
Plugin.getClanDataAccess().setHome(clan, caller.getLocation(), caller.getName());
|
||||
|
||||
Plugin.ClanTips.displayTip(TipType.SETHOME, caller);
|
||||
|
||||
// Inform
|
||||
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.HandlerList;
|
||||
|
||||
import mineplex.game.clans.clans.ClanInfo;
|
||||
|
||||
public class PlayerClaimTerritoryEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@ -13,11 +15,14 @@ public class PlayerClaimTerritoryEvent extends Event
|
||||
private Chunk _claimedChunk;
|
||||
|
||||
private boolean _cancelled;
|
||||
|
||||
private ClanInfo _clan;
|
||||
|
||||
public PlayerClaimTerritoryEvent(Player claimer, Chunk claimedChunk)
|
||||
public PlayerClaimTerritoryEvent(Player claimer, Chunk claimedChunk, ClanInfo clan)
|
||||
{
|
||||
_claimer = claimer;
|
||||
_claimedChunk = claimedChunk;
|
||||
_clan = clan;
|
||||
}
|
||||
|
||||
public Player getClaimer()
|
||||
@ -25,6 +30,11 @@ public class PlayerClaimTerritoryEvent extends Event
|
||||
return _claimer;
|
||||
}
|
||||
|
||||
public ClanInfo getClan()
|
||||
{
|
||||
return _clan;
|
||||
}
|
||||
|
||||
public Chunk getClaimedChunk()
|
||||
{
|
||||
return _claimedChunk;
|
||||
@ -49,5 +59,5 @@ public class PlayerClaimTerritoryEvent extends Event
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -304,6 +304,7 @@ public class ClanMainPage extends ClanPageBase
|
||||
|
||||
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();
|
||||
ArrayList<String> lore = new ArrayList<String>(5);
|
||||
lore.add(" ");
|
||||
@ -323,9 +324,21 @@ public class ClanMainPage extends ClanPageBase
|
||||
if (guiRole.has(ClanRole.ADMIN))
|
||||
{
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.RESET + C.cYellow + "Left Click " + C.cWhite + "Promote");
|
||||
lore.add(ChatColor.RESET + C.cYellow + "Right Click " + C.cWhite + "Demote");
|
||||
lore.add(ChatColor.RESET + C.cYellow + "Shift-Right Click " + C.cWhite + "Kick");
|
||||
|
||||
if (!playerRole.has(ClanRole.LEADER) && guiRole.has(playerRole))
|
||||
{
|
||||
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);
|
||||
|
@ -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.WarInvasionStartEvent;
|
||||
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
|
||||
{
|
||||
@ -139,6 +139,9 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
|
||||
ClanInfo clanA = clan.getName().equals(war.getClanA()) ? clan : killerClan;
|
||||
ClanInfo clanB = clan.equals(clanA) ? killerClan : clan;
|
||||
_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
|
||||
{
|
||||
|
@ -4,11 +4,11 @@ import mineplex.core.common.util.UtilMath;
|
||||
|
||||
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
|
||||
private static final int HUT_MIN = 4;
|
||||
|
@ -43,10 +43,12 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
@ -68,14 +70,15 @@ public class Gameplay extends MiniPlugin
|
||||
private ClansManager _clansManager;
|
||||
private BlockRestore _blockRestore;
|
||||
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>();
|
||||
|
||||
public Gameplay(JavaPlugin plugin, ClansManager clansManager, BlockRestore blockRestore, DamageManager damageManager)
|
||||
|
||||
public Gameplay(JavaPlugin plugin, ClansManager clansManager, BlockRestore blockRestore, DamageManager damageManager)
|
||||
{
|
||||
super("PvP Gameplay", plugin);
|
||||
|
||||
|
||||
_clansManager = clansManager;
|
||||
_blockRestore = blockRestore;
|
||||
_damageManager = damageManager;
|
||||
@ -93,7 +96,7 @@ public class Gameplay extends MiniPlugin
|
||||
if (state == State.CAUGHT_ENTITY || state == State.CAUGHT_FISH)
|
||||
{
|
||||
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)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
|
||||
Block block = event.getBlockClicked().getRelative(event.getBlockFace());
|
||||
|
||||
|
||||
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);
|
||||
_bucketWater.put(block, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.BUCKET));
|
||||
|
||||
event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.BUCKET));
|
||||
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
|
||||
*/
|
||||
@EventHandler(ignoreCancelled=true)
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void foodChangeLevel(FoodLevelChangeEvent event)
|
||||
{
|
||||
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());
|
||||
}
|
||||
@ -167,30 +173,26 @@ public class Gameplay extends MiniPlugin
|
||||
public void BucketFill(PlayerBucketFillEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
if (event.getItemStack().getType() == Material.WATER_BUCKET)
|
||||
if (!_bucketWater.containsKey(event.getBlockClicked()))
|
||||
event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.WATER_BUCKET));
|
||||
|
||||
|
||||
if (event.getItemStack().getType() == Material.WATER_BUCKET) if (!_bucketWater.containsKey(event.getBlockClicked())) event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.WATER_BUCKET));
|
||||
|
||||
UtilInv.Update(event.getPlayer());
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void BucketWaterExpire(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.FAST) return;
|
||||
|
||||
HashSet<Block> remove = new HashSet<Block>();
|
||||
|
||||
|
||||
for (Block cur : _bucketWater.keySet())
|
||||
if (UtilTime.elapsed(_bucketWater.get(cur), 2000))
|
||||
remove.add(cur);
|
||||
|
||||
if (UtilTime.elapsed(_bucketWater.get(cur), 2000)) remove.add(cur);
|
||||
|
||||
for (Block cur : remove)
|
||||
_bucketWater.remove(cur);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void ObsidianCancel(BlockPlaceEvent event)
|
||||
{
|
||||
@ -204,9 +206,7 @@ public class Gameplay extends MiniPlugin
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void CommandPlace(BlockPlaceEvent event)
|
||||
{
|
||||
if (event.getBlock().getType() == Material.COMMAND ||
|
||||
event.getBlock().getType() == Material.NOTE_BLOCK ||
|
||||
event.getBlock().getType() == Material.REDSTONE_LAMP_ON)
|
||||
if (event.getBlock().getType() == Material.COMMAND || event.getBlock().getType() == Material.NOTE_BLOCK || event.getBlock().getType() == Material.REDSTONE_LAMP_ON)
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.item("Proximity Devices") + "."));
|
||||
event.setCancelled(true);
|
||||
@ -225,20 +225,22 @@ public class Gameplay extends MiniPlugin
|
||||
|
||||
/**
|
||||
* Disable all Piston related events in Clans
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onPistonExtend(BlockPistonExtendEvent event)
|
||||
public void onPistonExtend(BlockPistonExtendEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable all Piston related events in Clans
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onPistonRetract(BlockPistonRetractEvent event)
|
||||
public void onPistonRetract(BlockPistonRetractEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -248,8 +250,7 @@ public class Gameplay extends MiniPlugin
|
||||
{
|
||||
Material material = event.getItem().getType();
|
||||
|
||||
if (material == Material.LAVA_BUCKET || material == Material.LAVA
|
||||
|| material == Material.WATER_BUCKET || material == Material.WATER)
|
||||
if (material == Material.LAVA_BUCKET || material == Material.LAVA || material == Material.WATER_BUCKET || material == Material.WATER)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -258,25 +259,21 @@ public class Gameplay extends MiniPlugin
|
||||
@EventHandler
|
||||
public void WebBreak(BlockDamageEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (event.getBlock().getType() == Material.WEB)
|
||||
event.setInstaBreak(true);
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
if (event.getBlock().getType() == Material.WEB) event.setInstaBreak(true);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void LapisPlace(BlockPlaceEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (event.getBlock().getType() != Material.LAPIS_BLOCK)
|
||||
return;
|
||||
if (event.isCancelled()) 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();
|
||||
|
||||
@ -285,7 +282,7 @@ public class Gameplay extends MiniPlugin
|
||||
public void run()
|
||||
{
|
||||
block.setType(Material.WATER);
|
||||
block.setData((byte)0);
|
||||
block.setData((byte) 0);
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 8);
|
||||
block.getWorld().playSound(block.getLocation(), Sound.SPLASH, 2f, 1f);
|
||||
}
|
||||
@ -295,23 +292,20 @@ public class Gameplay extends MiniPlugin
|
||||
@EventHandler
|
||||
public void EnderChestBreak(BlockBreakEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
if (event.getBlock().getType() != Material.ENDER_CHEST) return;
|
||||
|
||||
if (event.getBlock().getType() != Material.ENDER_CHEST)
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
event.getBlock().setTypeId(0);
|
||||
event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().add(0.5, 0.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.ENDER_CHEST));
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void disableEnderPearls(PlayerInteractEvent event)
|
||||
{
|
||||
if (!isRightClick(event.getAction()))
|
||||
return;
|
||||
if (!isRightClick(event.getAction())) return;
|
||||
|
||||
if (event.hasItem() && event.getItem().getType() == Material.ENDER_PEARL)
|
||||
{
|
||||
@ -323,8 +317,7 @@ public class Gameplay extends MiniPlugin
|
||||
@EventHandler
|
||||
public void disableFlintNSteel(PlayerInteractEvent event)
|
||||
{
|
||||
if (!isRightClick(event.getAction()))
|
||||
return;
|
||||
if (!isRightClick(event.getAction())) return;
|
||||
|
||||
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)
|
||||
{
|
||||
return action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK;
|
||||
return action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void IronDoor(PlayerInteractEvent event)
|
||||
{
|
||||
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
|
||||
return;
|
||||
|
||||
if (event.getClickedBlock().getTypeId() != 71)
|
||||
return;
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) return;
|
||||
|
||||
if (event.getClickedBlock().getTypeId() != 71) return;
|
||||
|
||||
Block block = event.getClickedBlock();
|
||||
|
||||
//Knock
|
||||
|
||||
// Knock
|
||||
if (event.isCancelled())
|
||||
{
|
||||
if (!Recharge.Instance.use(event.getPlayer(), "Door Knock", 500, false, false))
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(event.getPlayer(), "Door Knock", 500, false, false)) return;
|
||||
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.ZOMBIE_CHEW_WOODEN_DOOR, 0);
|
||||
}
|
||||
|
||||
//Open
|
||||
|
||||
// Open
|
||||
else
|
||||
{
|
||||
if (block.getData() >= 8)
|
||||
block = block.getRelative(BlockFace.DOWN);
|
||||
|
||||
if (block.getData() < 4) block.setData((byte)(block.getData()+4), true);
|
||||
else block.setData((byte)(block.getData()-4), true);
|
||||
|
||||
//Effect
|
||||
if (block.getData() >= 8) block = block.getRelative(BlockFace.DOWN);
|
||||
|
||||
if (block.getData() < 4)
|
||||
block.setData((byte) (block.getData() + 4), true);
|
||||
else
|
||||
block.setData((byte) (block.getData() - 4), true);
|
||||
|
||||
// Effect
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.DOOR_TOGGLE, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void BrewingDisable(PlayerInteractEvent event)
|
||||
{
|
||||
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
|
||||
return;
|
||||
|
||||
if (event.getClickedBlock().getTypeId() != 117)
|
||||
return;
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) return;
|
||||
|
||||
if (event.getClickedBlock().getTypeId() != 117) return;
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@ -389,172 +378,183 @@ public class Gameplay extends MiniPlugin
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) return;
|
||||
else if (event.getClickedBlock().getType() != Material.ANVIL) return;
|
||||
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
|
||||
return;
|
||||
else if (event.getClickedBlock().getType() != Material.ANVIL)
|
||||
return;
|
||||
else if (player.isSneaking() && player.getItemInHand().getType() != Material.AIR) return;
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void BonemealCancel(PlayerInteractEvent event)
|
||||
{
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
{
|
||||
if (!UtilEvent.isAction(event, ActionType.R)) return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player.getItemInHand() == null)
|
||||
return;
|
||||
|
||||
if (player.getItemInHand().getType() != Material.INK_SACK)
|
||||
return;
|
||||
|
||||
if (player.getItemInHand().getData() == null)
|
||||
return;
|
||||
|
||||
if (player.getItemInHand().getData().getData() != 15)
|
||||
return;
|
||||
|
||||
|
||||
if (player.getItemInHand() == null) return;
|
||||
|
||||
if (player.getItemInHand().getType() != Material.INK_SACK) return;
|
||||
|
||||
if (player.getItemInHand().getData() == null) return;
|
||||
|
||||
if (player.getItemInHand().getData().getData() != 15) return;
|
||||
|
||||
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
|
||||
public void WildfireSpread(BlockBurnEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
for (int x=-1 ; x<=1 ; x++)
|
||||
for (int y=-1 ; y<=1 ; y++)
|
||||
for (int z=-1 ; z<=1 ; z++)
|
||||
for (int x = -1; x <= 1; x++)
|
||||
for (int y = -1; y <= 1; y++)
|
||||
for (int z = -1; z <= 1; z++)
|
||||
{
|
||||
//Self
|
||||
// Self
|
||||
if (x == 0 && y == 0 && z == 0)
|
||||
{
|
||||
event.getBlock().setType(Material.FIRE);
|
||||
|
||||
if (event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.GRASS)
|
||||
event.getBlock().getRelative(BlockFace.DOWN).setType(Material.DIRT);
|
||||
if (event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.GRASS) event.getBlock().getRelative(BlockFace.DOWN).setType(Material.DIRT);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Block block = event.getBlock().getRelative(x, y, z);
|
||||
|
||||
if (block.getRelative(BlockFace.DOWN).getType() == Material.GRASS)
|
||||
block.getRelative(BlockFace.DOWN).setType(Material.DIRT);
|
||||
if (block.getRelative(BlockFace.DOWN).getType() == Material.GRASS) block.getRelative(BlockFace.DOWN).setType(Material.DIRT);
|
||||
|
||||
//Surroundings
|
||||
if (!(
|
||||
(x == 0 && y == 0) ||
|
||||
(x == 0 && z == 0) ||
|
||||
(y == 0 && z == 0)
|
||||
))
|
||||
continue;
|
||||
|
||||
if (block.getTypeId() == 0)
|
||||
block.setType(Material.FIRE);
|
||||
// Surroundings
|
||||
if (!((x == 0 && y == 0) || (x == 0 && z == 0) || (y == 0 && z == 0))) continue;
|
||||
|
||||
if (block.getTypeId() == 0) block.setType(Material.FIRE);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void WildfireDirt(BlockIgniteEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
if (event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.GRASS)
|
||||
event.getBlock().getRelative(BlockFace.DOWN).setType(Material.DIRT);
|
||||
if (event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.GRASS) event.getBlock().getRelative(BlockFace.DOWN).setType(Material.DIRT);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void WildfireCancel(BlockIgniteEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
if (event.getBlock().getBiome() == Biome.JUNGLE || event.getBlock().getBiome() == Biome.JUNGLE_HILLS)
|
||||
if (event.getCause() == IgniteCause.SPREAD)
|
||||
event.setCancelled(true);
|
||||
if (event.getBlock().getBiome() == Biome.JUNGLE || event.getBlock().getBiome() == Biome.JUNGLE_HILLS) if (event.getCause() == IgniteCause.SPREAD) event.setCancelled(true);
|
||||
}
|
||||
|
||||
// @EventHandler
|
||||
// public void onBlockPlace(BlockPlaceEvent event)
|
||||
// {
|
||||
// Location location = event.getBlock().getLocation();
|
||||
//
|
||||
// if (_clansManager.getClanUtility().isNearAdminClaim(location))
|
||||
// {
|
||||
// event.setCancelled(true);
|
||||
// UtilPlayer.message(event.getPlayer(), F.main("Admin", "You cannot place blocks near admin territories!"));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @EventHandler
|
||||
// public void onBlockBreak(BlockBreakEvent event)
|
||||
// {
|
||||
// Location location = event.getBlock().getLocation();
|
||||
//
|
||||
// if (_clansManager.getClanUtility().isNearAdminClaim(location))
|
||||
// {
|
||||
// event.setCancelled(true);
|
||||
// UtilPlayer.message(event.getPlayer(), F.main("Admin", "You cannot break blocks near admin territories!"));
|
||||
// }
|
||||
// }
|
||||
// @EventHandler
|
||||
// public void onBlockPlace(BlockPlaceEvent event)
|
||||
// {
|
||||
// Location location = event.getBlock().getLocation();
|
||||
//
|
||||
// if (_clansManager.getClanUtility().isNearAdminClaim(location))
|
||||
// {
|
||||
// event.setCancelled(true);
|
||||
// UtilPlayer.message(event.getPlayer(), F.main("Admin", "You cannot place
|
||||
// blocks near admin territories!"));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @EventHandler
|
||||
// public void onBlockBreak(BlockBreakEvent event)
|
||||
// {
|
||||
// Location location = event.getBlock().getLocation();
|
||||
//
|
||||
// if (_clansManager.getClanUtility().isNearAdminClaim(location))
|
||||
// {
|
||||
// event.setCancelled(true);
|
||||
// UtilPlayer.message(event.getPlayer(), F.main("Admin", "You cannot break
|
||||
// blocks near admin territories!"));
|
||||
// }
|
||||
// }
|
||||
|
||||
/*
|
||||
@EventHandler (priority = EventPriority.HIGHEST)
|
||||
public void MoneyLossSteal(CombatDeathEvent event)
|
||||
{
|
||||
if (!(event.GetEvent().getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player)event.GetEvent().getEntity();
|
||||
|
||||
int balance = Clients().Get(player).Game().GetEconomyBalance();
|
||||
|
||||
int lose = (int) (0.04 * balance);
|
||||
|
||||
//Balance
|
||||
Clients().Get(player).Game().SetEconomyBalance(balance - lose);
|
||||
|
||||
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 (priority = EventPriority.HIGHEST) public void
|
||||
* MoneyLossSteal(CombatDeathEvent event) { if
|
||||
* (!(event.GetEvent().getEntity() instanceof Player)) return; Player player
|
||||
* = (Player)event.GetEvent().getEntity(); int balance =
|
||||
* Clients().Get(player).Game().GetEconomyBalance(); int lose = (int) (0.04
|
||||
* * balance); //Balance
|
||||
* Clients().Get(player).Game().SetEconomyBalance(balance - lose); 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
|
||||
public void SpawnDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetCause() != DamageCause.FALL)
|
||||
return;
|
||||
|
||||
if (!_clansManager.getClanUtility().isSpecial(event.GetDamageeEntity().getLocation(), "Spawn"))
|
||||
return;
|
||||
|
||||
if (event.IsCancelled()) return;
|
||||
|
||||
if (event.GetCause() != DamageCause.FALL) return;
|
||||
|
||||
if (!_clansManager.getClanUtility().isSpecial(event.GetDamageeEntity().getLocation(), "Spawn")) return;
|
||||
|
||||
event.SetCancelled("Spawn Fall");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cancel the spawning of all Witches.
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
@ -571,11 +571,7 @@ public class Gameplay extends MiniPlugin
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (event.getClickedBlock() == null
|
||||
|| event.getClickedBlock().getType() != Material.ANVIL
|
||||
|| !UtilEvent.isAction(event, ActionType.R_BLOCK)
|
||||
|| player.isSneaking()
|
||||
|| player.getItemInHand().getType() == Material.AIR)
|
||||
if (event.getClickedBlock() == null || event.getClickedBlock().getType() != Material.ANVIL || !UtilEvent.isAction(event, ActionType.R_BLOCK) || player.isSneaking() || player.getItemInHand().getType() == Material.AIR)
|
||||
{
|
||||
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") + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ItemStack item = player.getItemInHand();
|
||||
|
||||
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()) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int repairs = ItemStackFactory.Instance.GetLoreVar(item, "Repaired", 0);
|
||||
boolean canRepair = canRepair(item);
|
||||
|
||||
|
||||
if (!canRepair)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Repair", "This item cannot be repaired anymore."));
|
||||
return;
|
||||
}
|
||||
|
||||
String creator = ItemStackFactory.Instance.GetLoreVar(item, "Owner");
|
||||
|
||||
|
||||
String creator = ItemStackFactory.Instance.GetLoreVar(item, "Owner");
|
||||
|
||||
if (creator != null)
|
||||
{
|
||||
if (creator.length() > 2)
|
||||
creator = creator.substring(2, creator.length());
|
||||
if (creator.length() > 2) creator = creator.substring(2, creator.length());
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
//Repair!
|
||||
|
||||
// Repair!
|
||||
UtilPlayer.message(player, F.main("Repair", "You repaired " + F.item(item.getItemMeta().getDisplayName()) + "."));
|
||||
item.setDurability((short)0);
|
||||
item.setDurability((short) 0);
|
||||
UtilInv.Update(player);
|
||||
|
||||
//Break
|
||||
if (Math.random() > 0.85)
|
||||
event.getClickedBlock().setData((byte) (event.getClickedBlock().getData() + 4));
|
||||
|
||||
// Break
|
||||
if (Math.random() > 0.85) event.getClickedBlock().setData((byte) (event.getClickedBlock().getData() + 4));
|
||||
|
||||
if (event.getClickedBlock().getData() >= 12)
|
||||
{
|
||||
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) + "");
|
||||
if (!canRepair(item))
|
||||
{
|
||||
@ -647,24 +641,23 @@ public class Gameplay extends MiniPlugin
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
|
||||
//Effect
|
||||
// Effect
|
||||
player.playSound(player.getLocation(), Sound.ANVIL_USE, 1f, 1f);
|
||||
}
|
||||
|
||||
|
||||
private boolean canRepair(ItemStack item)
|
||||
{
|
||||
int repairs = ItemStackFactory.Instance.GetLoreVar(item, "Repaired", 0);
|
||||
boolean gold = UtilGear.isGold(item);
|
||||
boolean canRepair = true;
|
||||
|
||||
|
||||
if (repairs >= 3 && gold)
|
||||
canRepair = false;
|
||||
else if (repairs >= 2 && !gold)
|
||||
canRepair = false;
|
||||
|
||||
else if (repairs >= 2 && !gold) canRepair = false;
|
||||
|
||||
return canRepair;
|
||||
}
|
||||
|
||||
|
||||
public DamageManager getDamageManager()
|
||||
{
|
||||
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)
|
||||
{
|
||||
super(type, data, name, new String[]
|
||||
{
|
||||
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);
|
||||
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);
|
||||
|
||||
_price = price;
|
||||
_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)
|
||||
{
|
||||
super(type, data, name, new String[]
|
||||
{
|
||||
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);
|
||||
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);
|
||||
|
||||
_price = buyPrice;
|
||||
_sellPrice = sellPrice;
|
||||
@ -60,17 +34,7 @@ public class PvpItem extends ShopItem
|
||||
|
||||
public PvpItem(Material type, byte data, int displayAmount, String name, int price)
|
||||
{
|
||||
super(type, data, name, new String[]
|
||||
{
|
||||
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);
|
||||
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);
|
||||
|
||||
_price = price;
|
||||
_bulkCount = -1;
|
||||
@ -80,7 +44,7 @@ public class PvpItem extends ShopItem
|
||||
{
|
||||
return _price;
|
||||
}
|
||||
|
||||
|
||||
public int getSellPrice()
|
||||
{
|
||||
return _sellPrice;
|
||||
|
@ -22,7 +22,7 @@ public class EnergyPage extends ShopPageBase<ClanEnergyManager, EnergyShop>
|
||||
super(plugin, shop, clientManager, donationManager, "Energy Shop", player, 18);
|
||||
buildPage();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
@ -35,20 +35,20 @@ public class EnergyPage extends ShopPageBase<ClanEnergyManager, EnergyShop>
|
||||
buildPurchase(clanInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void buildPurchase(ClanInfo clanInfo)
|
||||
{
|
||||
int energyPerMin = Math.max(1, clanInfo.getEnergyCostPerMinute());
|
||||
|
||||
|
||||
int oneHourEnergy = energyPerMin * 60;
|
||||
int oneDayEnergy = oneHourEnergy * 24;
|
||||
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, 13, oneDayEnergy, Material.REDSTONE_BLOCK, (byte) 0, " ", ChatColor.RESET + "1 Day of Energy", " ", ChatColor.RESET + "Costs " + C.cGreen + "$" + getPlugin().convertEnergyToGold(oneDayEnergy));
|
||||
addButton(clanInfo, 15, maxEnergy, Material.FURNACE, (byte) 0, " ", ChatColor.RESET + "Maxed Out Energy", " ", ChatColor.RESET + "Costs " + C.cGreen + "$" + getPlugin().convertEnergyToGold(maxEnergy));
|
||||
|
||||
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) + "g");
|
||||
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)
|
||||
{
|
||||
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 + "Drain: " + ChatColor.RESET + clanInfo.getEnergyCostPerMinute() * 60 + " per Hour");
|
||||
lore.add(C.cYellow + "Max Energy: " + ChatColor.RESET + clanInfo.getEnergyMax());
|
||||
if (clanInfo.getEnergyCostPerMinute() > 0)
|
||||
lore.add(C.cYellow + "Time Left: " + ChatColor.RESET + UtilTime.convertString((clanInfo.getEnergy() / clanInfo.getEnergyCostPerMinute()) * 60000L, 1, UtilTime.TimeUnit.FIT));
|
||||
|
||||
if (clanInfo.getEnergyCostPerMinute() > 0) 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);
|
||||
setItem(slot, shopItem);
|
||||
}
|
||||
|
||||
|
||||
private void addButton(ClanInfo clanInfo, int slot, int energyAmount, Material material, byte data, String... lore)
|
||||
{
|
||||
boolean locked = energyAmount > clanInfo.getEnergyPurchasable() || energyAmount == 0;
|
||||
String itemName = "Purchase " + energyAmount + " Energy";
|
||||
|
||||
|
||||
ShopItem shopItem = new ShopItem(material, itemName, lore, 1, locked, false);
|
||||
|
||||
|
||||
if (locked)
|
||||
setItem(slot, shopItem);
|
||||
else
|
||||
addButton(slot, shopItem, new EnergyShopButton(getPlugin(), this, energyAmount, clanInfo));
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class TravelButton implements IButton
|
||||
{
|
||||
C.cWhite + " ",
|
||||
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 + " ",
|
||||
}, 0, false, false);
|
||||
|
@ -1,11 +1,23 @@
|
||||
package mineplex.game.clans.spawn.travel;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
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.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
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.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)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, "Travel", player, 27);
|
||||
super(plugin, shop, clientManager, donationManager, "Travel", player, 45);
|
||||
|
||||
buildPage();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
addTravelLocation(Spawn.getEastSpawn(), Material.IRON_SWORD, "East Spawn", 14);
|
||||
addTravelLocation(Spawn.getWestSpawn(), Material.IRON_SWORD, "West Spawn", 12);
|
||||
addTravelLocation(Spawn.getEastSpawn(), Material.IRON_SWORD, "East Spawn", 14 + 10);
|
||||
addTravelLocation(Spawn.getWestSpawn(), Material.IRON_SWORD, "West Spawn", 12 + 8);
|
||||
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)
|
||||
|
@ -19,13 +19,13 @@ import mineplex.game.clans.spawn.Spawn;
|
||||
|
||||
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)
|
||||
{
|
||||
super(plugin, clientManager, donationManager, "Travel Hub");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
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
|
||||
*/
|
||||
@EventHandler
|
||||
public void onInventoryClickedd(InventoryClickEvent event)
|
||||
{
|
||||
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;
|
||||
|
||||
|
||||
String displayName = event.getCurrentItem().getItemMeta().getDisplayName();
|
||||
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.tutorials.commands.SkipTutorialCommand;
|
||||
import mineplex.game.clans.tutorials.commands.TaskInfoCommand;
|
||||
import mineplex.game.clans.tutorials.types.ClansTips;
|
||||
import mineplex.game.clans.tutorials.types.TutorialGettingStarted;
|
||||
|
||||
public class TutorialManager extends MiniPlugin
|
||||
@ -42,8 +41,6 @@ public class TutorialManager extends MiniPlugin
|
||||
_taskManager = taskManager;
|
||||
|
||||
_tutorials.put(TutorialGettingStarted.class, new TutorialGettingStarted(this, clansManager, goldManager, taskManager));
|
||||
|
||||
new ClansTips(this, preferencesManager);
|
||||
}
|
||||
|
||||
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