mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	@@ -88,16 +88,26 @@ public class Deny extends SubCommand {
 | 
			
		||||
        EventUtil.manager.callDenied(plr, plot, uuid, true);
 | 
			
		||||
        MainUtil.sendMessage(plr, C.DENIED_ADDED);
 | 
			
		||||
        if (!uuid.equals(DBFunc.everyone)) {
 | 
			
		||||
            handleKick(uuid, plot);
 | 
			
		||||
            handleKick(UUIDHandler.getPlayer(uuid), plot);
 | 
			
		||||
        } else {
 | 
			
		||||
            for (PlotPlayer pp : plot.getPlayersInPlot()) {
 | 
			
		||||
                handleKick(pp, plot);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    private void handleKick(final UUID uuid, final Plot plot) {
 | 
			
		||||
        final PlotPlayer pp = UUIDHandler.getPlayer(uuid);
 | 
			
		||||
        if ((pp != null) && plot.equals(MainUtil.getPlotAbs(pp.getLocation()))) {
 | 
			
		||||
            pp.teleport(BlockManager.manager.getSpawn(pp.getLocation().getWorld()));
 | 
			
		||||
            MainUtil.sendMessage(pp, C.YOU_GOT_DENIED);
 | 
			
		||||
    private void handleKick(final PlotPlayer pp, final Plot plot) {
 | 
			
		||||
        if (pp == null) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        if (!plot.equals(pp.getCurrentPlot())) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        if (pp.hasPermission("plots.admin.command.deny")) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        pp.teleport(BlockManager.manager.getSpawn(pp.getLocation().getWorld()));
 | 
			
		||||
        MainUtil.sendMessage(pp, C.YOU_GOT_DENIED);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,6 @@ public class Kick extends SubCommand {
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, final String[] args) {
 | 
			
		||||
        
 | 
			
		||||
        final Location loc = plr.getLocation();
 | 
			
		||||
        final Plot plot = MainUtil.getPlotAbs(loc);
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
@@ -59,6 +58,10 @@ public class Kick extends SubCommand {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        if (player.hasPermission("plots.admin.command.kick")) {
 | 
			
		||||
            C.CANNOT_KICK_PLAYER.send(plr, player.getName());
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        player.teleport(BlockManager.manager.getSpawn(loc.getWorld()));
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user