Fix bug where players could retrieve teleport items out of the Travel Hub shop and later use them in their inventory. Implement a safe zone region of one chunk around all administrative clans (excluding Wilderness), to prevent players from building/claiming next to admin clans. Disable pistons throughout the server to prevent griefing. Fix left-over merge issue with donation manager.
This commit is contained in:
parent
17fbd42b9c
commit
98ec99cffc
@ -394,7 +394,7 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
rewardGold(callback, caller, player.getName(), ClientManager.getCachedClientAccountId(player.getUniqueId()), total, false);
|
||||
rewardGold(callback, caller, player.getName(), ClientManager.getAccountId(player), total, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -300,6 +300,29 @@ public class ClansUtility
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isNearAdminClaim(Location location)
|
||||
{
|
||||
for (int xOffset = -1; xOffset <= 1; xOffset++)
|
||||
{
|
||||
for (int zOffset = -1; zOffset <= 1; zOffset++)
|
||||
{
|
||||
if (xOffset == 0 && zOffset == 0) continue;
|
||||
|
||||
String other = UtilWorld.chunkToStr(location.getWorld().getChunkAt(
|
||||
location.getChunk().getX()+xOffset, location.getChunk().getZ()+zOffset));
|
||||
|
||||
ClanInfo adjClan = getOwner(other);
|
||||
|
||||
if (adjClan != null && adjClan.isAdmin() && !adjClan.getName().equalsIgnoreCase("Wilderness"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public ClanInfo getOwner(ClanTerritory claim)
|
||||
{
|
||||
return getClanByClanName(claim.Owner);
|
||||
|
@ -947,6 +947,12 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
}
|
||||
}
|
||||
|
||||
if (Plugin.getClanUtility().isNearAdminClaim(caller.getLocation()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot claim so close to administrative territory!"));
|
||||
return;
|
||||
}
|
||||
|
||||
//Not Next to Self
|
||||
if (!selfAdj && !clan.getClaimSet().isEmpty())
|
||||
{
|
||||
|
@ -49,6 +49,8 @@ import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockDispenseEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
@ -225,6 +227,26 @@ public class Gameplay extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable all Piston related events in Clans
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onPistonExtend(BlockPistonExtendEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable all Piston related events in Clans
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onPistonRetract(BlockPistonRetractEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void DispenseLiquidCancel(BlockDispenseEvent event)
|
||||
{
|
||||
@ -463,6 +485,30 @@ public class Gameplay extends MiniPlugin
|
||||
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 onBlockPlace(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)
|
||||
|
@ -2,7 +2,11 @@ package mineplex.game.clans.spawn.travel;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -15,6 +19,8 @@ import mineplex.game.clans.spawn.Spawn;
|
||||
|
||||
public class TravelShop extends ShopBase<ClansManager>
|
||||
{
|
||||
public static final String[] TRAVEL_LOCATIONS = {"East Shop", "West Shop", "North Spawn", "South Spawn"};
|
||||
|
||||
public TravelShop(ClansManager plugin, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager)
|
||||
{
|
||||
super(plugin, clientManager, donationManager, "Travel Hub");
|
||||
@ -38,6 +44,27 @@ public class TravelShop extends ShopBase<ClansManager>
|
||||
return super.attemptShopOpen(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.getItemMeta() == null || item.getItemMeta().getDisplayName() == null) return;
|
||||
else if (isPlayerInShop(event.getWhoClicked())) return;
|
||||
|
||||
String displayName = event.getCurrentItem().getItemMeta().getDisplayName();
|
||||
for (String travelLocation : TRAVEL_LOCATIONS)
|
||||
{
|
||||
if (displayName.contains(travelLocation))
|
||||
{
|
||||
event.setCurrentItem(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void notify(Player player, String message)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Travel Hub", message));
|
||||
|
Loading…
Reference in New Issue
Block a user