Merge remote-tracking branch 'origin/clans-beta' into clans-beta
Conflicts: Plugins/.idea/compiler.xml Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilItem.java Plugins/Mineplex.Core/.classpath Plugins/Mineplex.Core/src/mineplex/core/TablistFix.java Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java Plugins/Mineplex.Hub/.classpath Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java
This commit is contained in:
commit
b8cc967fb0
@ -6,6 +6,7 @@
|
||||
<directory url="file://$PROJECT_DIR$/Nautilus.Game.PvP" includeSubdirectories="true" />
|
||||
<directory url="file://$PROJECT_DIR$/Mineplex.ServerMonitor" includeSubdirectories="true" />
|
||||
<directory url="file://$PROJECT_DIR$/Mineplex.Game.Clans" includeSubdirectories="true" />
|
||||
|
||||
</excludeFromCompile>
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
@ -29,9 +30,7 @@
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel target="1.7">
|
||||
<module name="bungee" target="1.7" />
|
||||
</bytecodeTargetLevel>
|
||||
<bytecodeTargetLevel target="1.7" />
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="GENERATE_NO_WARNINGS" value="true" />
|
||||
|
@ -1,8 +1,6 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
@ -24,15 +22,6 @@ public class UtilAlg
|
||||
|
||||
return sortedSet;
|
||||
}
|
||||
|
||||
public static <T> TreeSet<T> sortSet(Collection<T> toSort, Comparator<T> comparator)
|
||||
{
|
||||
TreeSet<T> sortedSet = new TreeSet<T>(comparator);
|
||||
for (T cur : toSort)
|
||||
sortedSet.add(cur);
|
||||
|
||||
return sortedSet;
|
||||
}
|
||||
|
||||
public static Location getMidpoint(Location a, Location b)
|
||||
{
|
||||
@ -419,23 +408,6 @@ public class UtilAlg
|
||||
return bestLoc;
|
||||
}
|
||||
|
||||
public static Location getNearestCornerLocation(Location near, Block block)
|
||||
{
|
||||
ArrayList<Location> corners = new ArrayList<Location>();
|
||||
|
||||
corners.add(block.getLocation().clone());
|
||||
corners.add(block.getLocation().clone().add(.999, 0, 0));
|
||||
corners.add(block.getLocation().clone().add(.999, 0, .999));
|
||||
corners.add(block.getLocation().clone().add(0, 0, .999));
|
||||
|
||||
corners.add(block.getLocation().clone().add(0, .999, 0));
|
||||
corners.add(block.getLocation().clone().add(.999, .999, 0));
|
||||
corners.add(block.getLocation().clone().add(.999, .999, .999));
|
||||
corners.add(block.getLocation().clone().add(0, .999, .999));
|
||||
|
||||
return UtilAlg.findClosest(near, corners);
|
||||
}
|
||||
|
||||
public static Vector calculateVelocity(Vector from, Vector to, double heightGain, Entity entity)
|
||||
{
|
||||
if (entity instanceof LivingEntity)
|
||||
@ -484,5 +456,21 @@ public class UtilAlg
|
||||
double vz = vh * dirz;
|
||||
return new Vector(vx, vy, vz);
|
||||
}
|
||||
|
||||
|
||||
public static Location getNearestCornerLocation(Location near, Block block)
|
||||
{
|
||||
ArrayList<Location> corners = new ArrayList<Location>();
|
||||
|
||||
corners.add(block.getLocation().clone());
|
||||
corners.add(block.getLocation().clone().add(.999, 0, 0));
|
||||
corners.add(block.getLocation().clone().add(.999, 0, .999));
|
||||
corners.add(block.getLocation().clone().add(0, 0, .999));
|
||||
|
||||
corners.add(block.getLocation().clone().add(0, .999, 0));
|
||||
corners.add(block.getLocation().clone().add(.999, .999, 0));
|
||||
corners.add(block.getLocation().clone().add(.999, .999, .999));
|
||||
corners.add(block.getLocation().clone().add(0, .999, .999));
|
||||
|
||||
return UtilAlg.findClosest(near, corners);
|
||||
}
|
||||
}
|
||||
|
@ -141,6 +141,16 @@ public class UtilItem
|
||||
return item.getType() + ":" + item.getAmount() + ":" + item.getDurability() + ":" + data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param item - the item to be checked for material type
|
||||
* @param material - the material to check if it matches
|
||||
* @return true, if {@code item} is non-null and its material type matches {@code material}.
|
||||
*/
|
||||
public static boolean matchesMaterial(ItemStack item, Material material)
|
||||
{
|
||||
return item != null && item.getType() == material;
|
||||
}
|
||||
|
||||
public static boolean isFood(ItemStack item)
|
||||
{
|
||||
return item == null ? false : isFood(item.getType());
|
||||
@ -156,14 +166,4 @@ public class UtilItem
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param item - the item to be checked for material type
|
||||
* @param material - the material to check if it matches
|
||||
* @return true, if {@code item} is non-null and its material type matches {@code material}.
|
||||
*/
|
||||
public static boolean matchesMaterial(ItemStack item, Material material)
|
||||
{
|
||||
return item != null && item.getType() == material;
|
||||
}
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Database"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jooq-3.5.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/NoCheatPlus.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.PlayerCache"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -22,7 +22,7 @@ public class TablistFix extends MiniPlugin
|
||||
// This is sort of experimental!
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onJoin(PlayerJoinEvent event)
|
||||
{
|
||||
{/*
|
||||
final Player player = event.getPlayer();
|
||||
runSyncLater(new Runnable()
|
||||
{
|
||||
@ -45,9 +45,10 @@ public class TablistFix extends MiniPlugin
|
||||
}
|
||||
}
|
||||
}, 20L);
|
||||
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
}
|
||||
public static void refreshForPlayer(Player player)
|
||||
{
|
||||
if (!UtilPlayer.is1_8(player))
|
||||
|
@ -370,7 +370,8 @@ public class CoreClientManager extends MiniPlugin
|
||||
// Reserved Slot Check
|
||||
if (Bukkit.getOnlinePlayers().size() >= Bukkit.getServer().getMaxPlayers())
|
||||
{
|
||||
// if (client.GetRank().has(event.getPlayer(), Rank.ULTRA, false))
|
||||
// TODO: REMOVE THIS RESTRICTION FROM CLANS-BRANCH, USED TO PREVENT ULTRA FROM JOINING CLANS
|
||||
// if (client.GetRank().Has(event.getPlayer(), Rank.ULTRA, false))
|
||||
// {
|
||||
// event.allow();
|
||||
// event.setResult(PlayerLoginEvent.Result.ALLOWED);
|
||||
|
@ -83,7 +83,7 @@ public class Creature extends MiniPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
CreatureSpawnCustomEvent customEvent = new CreatureSpawnCustomEvent(event.getLocation());
|
||||
CreatureSpawnCustomEvent customEvent = new CreatureSpawnCustomEvent(event.getLocation(), event.getSpawnReason());
|
||||
|
||||
_plugin.getServer().getPluginManager().callEvent(customEvent);
|
||||
|
||||
|
@ -4,6 +4,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
|
||||
public class CreatureSpawnCustomEvent extends Event implements Cancellable
|
||||
{
|
||||
@ -11,10 +12,12 @@ public class CreatureSpawnCustomEvent extends Event implements Cancellable
|
||||
private boolean _cancelled = false;
|
||||
|
||||
private Location _location;
|
||||
private SpawnReason _reason;
|
||||
|
||||
public CreatureSpawnCustomEvent(Location location)
|
||||
public CreatureSpawnCustomEvent(Location location, SpawnReason reason)
|
||||
{
|
||||
_location = location;
|
||||
_reason = reason;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
@ -43,4 +46,9 @@ public class CreatureSpawnCustomEvent extends Event implements Cancellable
|
||||
{
|
||||
return _location;
|
||||
}
|
||||
|
||||
public SpawnReason getReason()
|
||||
{
|
||||
return _reason;
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
|
||||
_buttonMap.get(event.getRawSlot()).onClick(_player, event.getClick());
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else if ((rawSlot != -999 && rawSlot < inventory.getSize()) || shiftClick)
|
||||
else if ((rawSlot >= 0 && rawSlot < inventory.getSize()) || shiftClick)
|
||||
{
|
||||
playDenySound(_player);
|
||||
event.setCancelled(true);
|
||||
|
@ -62,7 +62,7 @@ public class ClanRepository extends RepositoryBase
|
||||
private static String ADD_CLAN = "INSERT INTO clans (serverId, name, description, home, admin, dateCreated, energy, lastOnline) VALUES (?, ?, ?, ?, ?, now(), ?, now());";
|
||||
private static String ADD_CLAN_MEMBER = "INSERT INTO accountClan (accountId, clanId, clanRole) SELECT accounts.id, ?, ? FROM accounts WHERE accounts.name = ?;";
|
||||
private static String ADD_CLAN_ALLIANCE = "INSERT INTO clanAlliances (clanId, otherClanId, trusted) VALUES (?, ?, ?);";
|
||||
private static String ADD_CLAN_ENEMY = "INSERT INTO clanEnemies (clanId, otherClanId, timeFormed) VALUES (?, ?, now());";
|
||||
private static String ADD_CLAN_ENEMY = "INSERT INTO clanEnemies (clanId, otherClanId, initiator, timeFormed) VALUES (?, ?, 1, now());";
|
||||
private static String ADD_CLAN_TERRITORY = "INSERT INTO clanTerritory (clanId, chunk, safe) VALUES (?, ?, ?);";
|
||||
|
||||
private static String UPDATE_CLAN = "UPDATE clans SET name = ?, description = ?, home = ?, admin = ?, energy = ?, kills = ?, murder = ?, deaths = ?, warWins = ?, warLosses = ?, lastOnline = ? WHERE id = ?;";
|
||||
|
@ -19,7 +19,6 @@ import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.explosion.Explosion;
|
||||
import mineplex.core.friend.FriendManager;
|
||||
import mineplex.core.give.Give;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.ignore.IgnoreManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
@ -105,6 +104,7 @@ public class Clans extends JavaPlugin
|
||||
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());
|
||||
@ -117,13 +117,12 @@ public class Clans extends JavaPlugin
|
||||
new Explosion(this, blockRestore);
|
||||
new FriendManager(this, _clientManager, preferenceManager, portal);
|
||||
new InventoryManager(this, _clientManager);
|
||||
HologramManager hologramManager = new HologramManager(this);
|
||||
|
||||
// Enable custom-gear related managers
|
||||
PacketHandler packetHandler = new PacketHandler(this);
|
||||
GearManager customGear = new GearManager(this, packetHandler);
|
||||
|
||||
_clansManager = new ClansManager(this, serverStatusManager.getCurrentServerName(), _clientManager, _donationManager, blockRestore, teleport, chat, customGear, hologramManager, webServerAddress);
|
||||
_clansManager = new ClansManager(this, serverStatusManager.getCurrentServerName(), _clientManager, _donationManager, blockRestore, teleport, chat, customGear, webServerAddress);
|
||||
new Recipes(this);
|
||||
new Farming(this);
|
||||
new BuildingShop(_clansManager, _clientManager, _donationManager);
|
||||
|
@ -518,7 +518,7 @@ public class ClansAdmin
|
||||
|
||||
if (!callerClan.isAlly(otherClan.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You cannot give trust to enemies."));
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You must be allied to trust a clan!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -355,12 +355,14 @@ public class ClansDataAccessLayer
|
||||
ClanEnemyToken clanEnemyToken = new ClanEnemyToken();
|
||||
clanEnemyToken.Initiator = true;
|
||||
clanEnemyToken.TimeFormed = currDate;
|
||||
clanEnemyToken.Score = 0;
|
||||
clanEnemyToken.EnemyName = otherClan.getName();
|
||||
clan.updateEnemy(clanEnemyToken);
|
||||
clan.updateEnemy(clanEnemyToken);
|
||||
|
||||
ClanEnemyToken otherClanEnemyToken = new ClanEnemyToken();
|
||||
otherClanEnemyToken.Initiator = false;
|
||||
otherClanEnemyToken.TimeFormed = currDate;
|
||||
otherClanEnemyToken.Score = 0;
|
||||
otherClanEnemyToken.EnemyName = clan.getName();
|
||||
otherClan.updateEnemy(otherClanEnemyToken);
|
||||
|
||||
|
@ -19,7 +19,6 @@ import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||
@ -59,13 +58,6 @@ public class ClansGame extends MiniPlugin
|
||||
super("Clans Game", plugin);
|
||||
|
||||
Clans = clans;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void preventHorseSpawn(CreatureSpawnEvent event)
|
||||
{
|
||||
if (event.getEntityType() == EntityType.HORSE)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -468,7 +460,9 @@ public class ClansGame extends MiniPlugin
|
||||
|
||||
//Block Placement
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK)
|
||||
{
|
||||
if (player.getItemInHand().getType() != Material.AIR)
|
||||
{
|
||||
if (player.getGameMode() != GameMode.CREATIVE && Clans.getClanBlocks().denyUsePlace(player.getItemInHand().getTypeId()))
|
||||
{
|
||||
//Disallow
|
||||
@ -485,6 +479,8 @@ public class ClansGame extends MiniPlugin
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerItemBreakEvent;
|
||||
@ -421,9 +422,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
{
|
||||
ClanInfo clan = _clanUtility.getOwner(event.GetLocation());
|
||||
|
||||
if (clan != null)
|
||||
if (!clan.isAdmin() && !clan.getName().equals("Spawn"))
|
||||
event.setCancelled(true);
|
||||
if (clan != null && !clan.isAdmin()
|
||||
&& !clan.getName().equals("Spawn") && event.getReason() != SpawnReason.CUSTOM)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@ -814,7 +817,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
public void onJoin(PlayerLoginEvent event)
|
||||
{
|
||||
Rank rank = _clientManager.Get(event.getPlayer()).GetRank();
|
||||
if (!rank.Has(Rank.MEDIA) && !event.getPlayer().isWhitelisted())
|
||||
if (!rank.has(Rank.MEDIA) && !event.getPlayer().isWhitelisted())
|
||||
{
|
||||
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
|
||||
// event.setKickMessage("This server is whitelisted!");
|
||||
|
@ -38,7 +38,8 @@ public class EnemyData
|
||||
|
||||
public void addScore(int add)
|
||||
{
|
||||
_score = Math.max(0, Math.min(_score + add, 40));
|
||||
int newScore = _score + add;
|
||||
_score = Math.max(-40, Math.min(40, newScore)); // Cap range of score to [-40, 40]
|
||||
}
|
||||
|
||||
public void addKill()
|
||||
|
@ -15,7 +15,7 @@ public class ClansAllyChatCommand extends CommandBase<ClansManager>
|
||||
{
|
||||
super(plugin, Rank.ALL, "ac");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
|
@ -786,7 +786,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (!cA.isAlly(cB.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot give trust to enemies."));
|
||||
UtilPlayer.message(caller, F.main("Clans", "You must be allied to trust a clan!"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class ItemMapManager extends MiniPlugin
|
||||
public ItemMapManager(ClansManager clansManager, WorldEventManager eventManager)
|
||||
{
|
||||
super("ItemMapManager", clansManager.getPlugin());
|
||||
|
||||
|
||||
_clansUtility = clansManager.getClanUtility();
|
||||
_eventManager = eventManager;
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class ClansScoreboardManager extends ScoreboardManager
|
||||
{
|
||||
refresh(player);
|
||||
TablistFix.refreshForPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void refresh(Player player)
|
||||
|
@ -57,7 +57,7 @@ public class WarManager extends MiniPlugin
|
||||
private WarState calculateWarState()
|
||||
{
|
||||
// Get a calendar snapshot of the current time using server timezone
|
||||
Calendar calendar = Calendar.getInstance(_clansManager.getServerTimeZone());
|
||||
Calendar calendar = getCurrentDate();
|
||||
|
||||
WarState warState = WarState.WAR;
|
||||
|
||||
@ -68,6 +68,12 @@ public class WarManager extends MiniPlugin
|
||||
|
||||
return warState;
|
||||
}
|
||||
|
||||
private Calendar getCurrentDate()
|
||||
{
|
||||
Calendar date = Calendar.getInstance(_clansManager.getServerTimeZone());
|
||||
return date;
|
||||
}
|
||||
|
||||
public void attemptEnemy(Player player, ClanInfo initiatingClan, ClanInfo otherClan)
|
||||
{
|
||||
@ -178,7 +184,7 @@ public class WarManager extends MiniPlugin
|
||||
*/
|
||||
public Date getNextEnemyTime()
|
||||
{
|
||||
Calendar c = Calendar.getInstance(_clansManager.getServerTimeZone());
|
||||
Calendar c = getCurrentDate();
|
||||
int currDayOfWeek = c.get(Calendar.DAY_OF_WEEK);
|
||||
|
||||
c.set(Calendar.DAY_OF_WEEK, CREATE_ENEMY_DATE);
|
||||
@ -198,7 +204,7 @@ public class WarManager extends MiniPlugin
|
||||
*/
|
||||
public Date getNextInvadeTime()
|
||||
{
|
||||
Calendar c = Calendar.getInstance(_clansManager.getServerTimeZone());
|
||||
Calendar c = getCurrentDate();
|
||||
int currDayOfWeek = c.get(Calendar.DAY_OF_WEEK);
|
||||
|
||||
c.set(Calendar.DAY_OF_WEEK, INVADE_ENEMY_DATE);
|
||||
@ -214,7 +220,7 @@ public class WarManager extends MiniPlugin
|
||||
|
||||
public Date getNextWarStart()
|
||||
{
|
||||
Calendar c = Calendar.getInstance(_clansManager.getServerTimeZone());
|
||||
Calendar c = getCurrentDate();
|
||||
int currDayOfWeek = c.get(Calendar.DAY_OF_WEEK);
|
||||
|
||||
c.set(Calendar.DAY_OF_WEEK, INVADE_ENEMY_DATE);
|
||||
|
@ -78,7 +78,7 @@ public class CustomItem
|
||||
// Display attribute descriptions and stats in lore
|
||||
for (ItemAttribute attribute : _attributes.getAttributes())
|
||||
{
|
||||
String attributeLine = ATTRIBUTE_COLOR + "-" + attribute.getDescription();
|
||||
String attributeLine = ATTRIBUTE_COLOR + "• " + attribute.getDescription();
|
||||
lore.add(attributeLine);
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,8 @@ import java.util.Set;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
@ -401,11 +403,16 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
|
||||
/**
|
||||
* @return singleton instance of {@link GearManager}.
|
||||
*/
|
||||
public static GearManager getInstane()
|
||||
public static GearManager getInstance()
|
||||
{
|
||||
return _instance;
|
||||
}
|
||||
|
||||
public static void notify(Player player, String message)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Gear", message));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player - the player to see if they should have their out-going packets
|
||||
* masked on CustomGear items.
|
||||
@ -431,6 +438,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
|
||||
net.minecraft.server.v1_7_R4.ItemStack original = slotPacket.c;
|
||||
CraftItemStack originalItem = CraftItemStack.asCraftMirror(original);
|
||||
ItemMeta originalMeta = originalItem.getItemMeta();
|
||||
|
||||
if (originalMeta == null || originalMeta.getLore() == null) return; // No need to modify item packets with no lore
|
||||
|
||||
List<String> lore = new ArrayList<String>();
|
||||
|
@ -3,6 +3,7 @@ package mineplex.game.clans.items;
|
||||
import mineplex.game.clans.items.attributes.AttributeContainer;
|
||||
import mineplex.game.clans.items.attributes.ItemAttribute;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import net.minecraft.server.v1_7_R4.Material;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -20,6 +21,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerGameModeChangeEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -47,11 +49,11 @@ public class ItemListener implements Listener
|
||||
{
|
||||
if (event.getNewGameMode() == GameMode.CREATIVE) // Entering creative mode
|
||||
{
|
||||
GearManager.getInstane().addCreativePlayer(event.getPlayer());
|
||||
GearManager.getInstance().addCreativePlayer(event.getPlayer());
|
||||
}
|
||||
else if (event.getPlayer().getGameMode() == GameMode.CREATIVE) // Exiting creative mode
|
||||
{
|
||||
GearManager.getInstane().removeCreativePlayer(event.getPlayer());
|
||||
GearManager.getInstance().removeCreativePlayer(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,17 +163,45 @@ public class ItemListener implements Listener
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
// Prevent players from equipping armour items in hand (prevents lore-breaking bug)
|
||||
ItemStack itemInHand = event.getItem();
|
||||
if (isArmour(itemInHand))
|
||||
{
|
||||
Action action = event.getAction();
|
||||
boolean rightClick = action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK;
|
||||
|
||||
if (rightClick)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
GearManager.notify(event.getPlayer(), "You must manually equip armour!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Activate weapon interact abilities
|
||||
PlayerGear playerGear = getGear(event.getPlayer());
|
||||
playerGear.onInteract(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type - the {@link org.bukkit.Material} type to be checked for armour type
|
||||
* @return true, if {@code type} is an equipable armour-based material, false otherwise.
|
||||
*/
|
||||
private boolean isArmour(ItemStack item)
|
||||
{
|
||||
if (item == null) return false;
|
||||
|
||||
String name = item.getType().toString();
|
||||
return name.endsWith("HELMET") || name.endsWith("CHESTPLATE")
|
||||
|| name.endsWith("LEGGINGS") || name.endsWith("BOOTS");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player - the player whose gear is to be fetched
|
||||
* @return the {@link PlayerGear} associated with {@code player}.
|
||||
*/
|
||||
private PlayerGear getGear(Player player)
|
||||
{
|
||||
return GearManager.getInstane().getPlayerGear(player);
|
||||
return GearManager.getInstance().getPlayerGear(player);
|
||||
}
|
||||
}
|
||||
|
@ -58,8 +58,8 @@ public class GearCommand extends CommandBase<GearManager>
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector direction = caller.getLocation().getDirection().normalize();
|
||||
_gearManager.spawnItem(caller.getEyeLocation().add(direction));
|
||||
//caller.setFoodLevel(10);
|
||||
//return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class ShopItemButton<T extends ShopPageBase<?, ?>> implements IButton
|
||||
if (success)
|
||||
{
|
||||
giftItem(player, amount);
|
||||
GoldManager.notify(player, String.format("You have purchased %d items for %dg!", amount, cost));
|
||||
GoldManager.notify(player, String.format("You have purchased %d item(s) for %dg!", amount, cost));
|
||||
_page.playAcceptSound(player);
|
||||
}
|
||||
else
|
||||
|
@ -24,14 +24,14 @@ public class FarmingPage extends ClansShopPage<FarmingShop>
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
addShopItem(1, Material.POTATO, 15, 3);
|
||||
addShopItem(1, Material.POTATO_ITEM, 15, 3);
|
||||
addShopItem(2, Material.MELON, 5, 1);
|
||||
addShopItem(3, Material.BREAD, 30, 6);
|
||||
addShopItem(4, Material.COOKED_BEEF, 50, 10);
|
||||
addShopItem(5, Material.GRILLED_PORK, 50, 10);
|
||||
addShopItem(6, Material.COOKED_CHICKEN, 35, 7);
|
||||
addShopItem(7, Material.FEATHER, 50, 10);
|
||||
addShopItem(8, Material.CARROT, 10, 2);
|
||||
addShopItem(8, Material.CARROT_ITEM, 10, 2);
|
||||
addShopItem(10, Material.MUSHROOM_SOUP, 200, 40);
|
||||
addShopItem(11, Material.SUGAR_CANE, 15, 3);
|
||||
addShopItem(12, Material.PUMPKIN, 30, 6);
|
||||
|
@ -6,12 +6,12 @@
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.Core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.ClassCombat"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-codec-1.6.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-io-2.4.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.ServerData"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jooq-3.5.2.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Database"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Game.Clans.Core"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-codec-1.6.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -251,6 +251,9 @@ public class ServerNpcPage extends ShopPageInventory<ServerManager, ServerNpcSho
|
||||
}
|
||||
else
|
||||
{
|
||||
if (slot >= 54)
|
||||
continue;
|
||||
|
||||
addButton(slot, getPrivateItem(serverInfo), new JoinServerButton(this, getPlugin(), serverInfo, getPlayer()));
|
||||
slot++;
|
||||
}
|
||||
@ -411,6 +414,9 @@ public class ServerNpcPage extends ShopPageInventory<ServerManager, ServerNpcSho
|
||||
{
|
||||
if (isInProgress(serverInfo))
|
||||
{
|
||||
ShopItem shopItem = buildShopItem(serverInfo, slotsNeeded);
|
||||
|
||||
addButton(slot, shopItem, new JoinServerButton(this, getPlugin(), serverInfo, getPlayer()));
|
||||
inProgress.add(serverInfo);
|
||||
}
|
||||
}
|
||||
@ -425,7 +431,7 @@ public class ServerNpcPage extends ShopPageInventory<ServerManager, ServerNpcSho
|
||||
|
||||
ShopItem shopItem = buildShopItem(serverInfo, slotsNeeded);
|
||||
|
||||
addButton(slot, shopItem, new JoinServerButton(this, getPlugin(), serverInfo, getPlayer()));
|
||||
addButton(slot, shopItem, new JoinServerButton(this, serverInfo));
|
||||
|
||||
slot++;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
@ -111,9 +111,14 @@ public class FissureData
|
||||
|
||||
Block block = _path.get(_handled);
|
||||
|
||||
//Cannot raise
|
||||
if (block.getTypeId() == 46)
|
||||
//Cannot raise TNT/ICE/WATER
|
||||
if (block.getTypeId() == 46
|
||||
|| block.getTypeId() == 79
|
||||
|| block.getTypeId() == 8
|
||||
|| block.getTypeId() == 9)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Block up = block.getRelative(0, _height + 1, 0);
|
||||
|
||||
@ -130,7 +135,6 @@ public class FissureData
|
||||
if (block.getTypeId() == 1) Host.Factory.BlockRestore().add(block, 4, block.getData(), 14000);
|
||||
if (block.getTypeId() == 2) Host.Factory.BlockRestore().add(block, 3, block.getData(), 14000);
|
||||
if (block.getTypeId() == 98) Host.Factory.BlockRestore().add(block, 98, (byte) 0, 14000);
|
||||
|
||||
Host.Factory.BlockRestore().add(up, block.getTypeId(), block.getData(), 10000 - (1000 * _height));
|
||||
_height++;
|
||||
|
||||
|
@ -39,8 +39,8 @@ import nautilus.game.arcade.kit.Kit;
|
||||
public class BossBattles extends TeamGame
|
||||
{
|
||||
private WorldEvent _currentBoss;
|
||||
private BattleBoss _chosenBoss = BattleBoss.values()[UtilMath.r(BattleBoss
|
||||
.values().length)];
|
||||
private BattleBoss _chosenBoss =BattleBoss.SPIDER;
|
||||
// BattleBoss.values()[UtilMath.r(BattleBoss.values().length)];
|
||||
private ArrayList<BossDisplay> _displays = new ArrayList<BossDisplay>();
|
||||
|
||||
public BossBattles(ArcadeManager manager)
|
||||
|
Loading…
Reference in New Issue
Block a user