mirror of
https://e.coding.net/circlecloud/Residence.git
synced 2024-10-31 22:38:48 +00:00
fix some bug...
Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
parent
83105d2934
commit
92086e4f3a
@ -7,7 +7,11 @@ import org.bukkit.block.BlockFace;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
|
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||||
|
import org.bukkit.event.entity.SpawnerSpawnEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -23,6 +27,7 @@ public class ResidenceBugFix implements Listener {
|
|||||||
plugin.getLogger().info("防刷甘蔗补丁已加载...");
|
plugin.getLogger().info("防刷甘蔗补丁已加载...");
|
||||||
plugin.getLogger().info("防刷单元补丁已加载...");
|
plugin.getLogger().info("防刷单元补丁已加载...");
|
||||||
plugin.getLogger().info("防刷铁轨补丁已加载...");
|
plugin.getLogger().info("防刷铁轨补丁已加载...");
|
||||||
|
// plugin.getLogger().info("防刷生物补丁已加载...");
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -35,6 +40,9 @@ public class ResidenceBugFix implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlace(final PlayerInteractEvent e) {
|
public void onPlace(final PlayerInteractEvent e) {
|
||||||
|
if (e.getAction() == Action.LEFT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.PHYSICAL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
final ItemStack it = p.getItemInHand();
|
final ItemStack it = p.getItemInHand();
|
||||||
@ -48,19 +56,70 @@ public class ResidenceBugFix implements Listener {
|
|||||||
}
|
}
|
||||||
final Block b1 = b.getRelative(bf, 1);
|
final Block b1 = b.getRelative(bf, 1);
|
||||||
final Block b2 = b.getRelative(bf, 2);
|
final Block b2 = b.getRelative(bf, 2);
|
||||||
final ClaimedResidence res = plugin.getResidenceManager().getByLoc(b2.getLocation());
|
final ClaimedResidence res = plugin.getResidenceManager().getByLoc(b1.getLocation());
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final FlagPermissions perms = plugin.getPermsByLocForPlayer(b.getLocation(), p);
|
final FlagPermissions perms = res.getPermissions();
|
||||||
final String world = p.getWorld().getName();
|
final String world = p.getWorld().getName();
|
||||||
if (b1.getType() != Material.AIR && b2.getType() == Material.AIR) {
|
if (b1.getType() != Material.AIR && b2.getType() == Material.AIR) {
|
||||||
if (!perms.playerHas(p.getName(), world, "place", false)) {
|
if (!perms.playerHas(p.getName(), world, "place", perms.playerHas(p.getName(), world, "build", false))) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
p.sendMessage(ChatColor.RED + plugin.getLanguage().getPhrase("NoPermission") + ChatColor.DARK_RED + " 别费劲了 领地BUG早修了");
|
p.sendMessage(ChatColor.RED + plugin.getLanguage().getPhrase("NoPermission") + ChatColor.DARK_RED + " 当前区域不允许此操作!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final Exception e2) {
|
} catch (final Exception e2) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onSpawn(final CreatureSpawnEvent e) {
|
||||||
|
// final SpawnReason sr = e.getSpawnReason();
|
||||||
|
// if (sr == SpawnReason.NATURAL) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// plugin.getLogger().info("=======CreatureSpawnEvent=======");
|
||||||
|
// plugin.getLogger().info(e.getEntity().getType().toString());
|
||||||
|
// plugin.getLogger().info(e.getEntityType().toString());
|
||||||
|
// plugin.getLogger().info(e.getSpawnReason().toString());
|
||||||
|
// plugin.getLogger().info("=======CreatureSpawnEvent=======");
|
||||||
|
// final Location loc = e.getLocation();
|
||||||
|
// if (sr == SpawnReason.BUILD_IRONGOLEM || sr == SpawnReason.BUILD_SNOWMAN || sr == SpawnReason.BUILD_WITHER) {
|
||||||
|
// final FlagPermissions perm = plugin.getPermsByLocForPlayer(loc, p);
|
||||||
|
// if (!perm.has("place", false)) {
|
||||||
|
// e.setCancelled(true);
|
||||||
|
// p.sendMessage(ChatColor.RED + plugin.getLanguage().getPhrase("NoPermission") + ChatColor.DARK_RED + " 当前区域无法建造生物!");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onSpawn(final EntitySpawnEvent e) {
|
||||||
|
// plugin.getLogger().info("=======EntitySpawnEvent=======");
|
||||||
|
// plugin.getLogger().info(e.getEntity().getType().toString());
|
||||||
|
// plugin.getLogger().info(e.getEntityType().toString());
|
||||||
|
// plugin.getLogger().info(e.getLocation().toString());
|
||||||
|
// plugin.getLogger().info("=======EntitySpawnEvent=======");
|
||||||
|
// if (e.getEntity() instanceof Player) {
|
||||||
|
// final Player p = (Player) e.getEntity();
|
||||||
|
// final EntityType et = e.getEntityType();
|
||||||
|
// final Location loc = e.getLocation();
|
||||||
|
// if (et == EntityType.WITHER || et == EntityType.SNOWMAN || et == EntityType.IRON_GOLEM) {
|
||||||
|
// final FlagPermissions perm = plugin.getPermsByLocForPlayer(loc, p);
|
||||||
|
// if (!perm.has("place", false)) {
|
||||||
|
// e.setCancelled(true);
|
||||||
|
// p.sendMessage(ChatColor.RED + plugin.getLanguage().getPhrase("NoPermission") + ChatColor.DARK_RED + " 当前区域无法建造生物!");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onSpawn(final SpawnerSpawnEvent e) {
|
||||||
|
// plugin.getLogger().info("=======SpawnerSpawnEvent=======");
|
||||||
|
// plugin.getLogger().info(e.getEntityType().toString());
|
||||||
|
// plugin.getLogger().info(e.getLocation().toString());
|
||||||
|
// plugin.getLogger().info(e.getSpawner().getSpawnedType().toString());
|
||||||
|
// plugin.getLogger().info("=======SpawnerSpawnEvent=======");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user