當前位置: 首頁>>代碼示例>>Java>>正文


Java SignChangeEvent.setCancelled方法代碼示例

本文整理匯總了Java中org.bukkit.event.block.SignChangeEvent.setCancelled方法的典型用法代碼示例。如果您正苦於以下問題:Java SignChangeEvent.setCancelled方法的具體用法?Java SignChangeEvent.setCancelled怎麽用?Java SignChangeEvent.setCancelled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.event.block.SignChangeEvent的用法示例。


在下文中一共展示了SignChangeEvent.setCancelled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkSign

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void checkSign(SignChangeEvent event) {
	if (ConfigFunction.AntiSpamenable && ConfigFunction.enableAntiDirty) {
		String[] lines = event.getLines();
		for (String line : lines) {
			Player player = event.getPlayer();
			if (AzureAPI.hasPerm(player, "EscapeLag.bypass.Spam")) {
				return;
			}
			for (String each : ConfigFunction.AntiSpamDirtyList) {
				boolean deny = true;
				for (char c : each.toLowerCase().toCharArray()) {
					if (!StringUtils.contains(line, c))
						deny = false;
				}
				if (deny) {
					event.setCancelled(true);
					AzureAPI.log(player, ConfigFunction.AntiSpamDirtyWarnMessage);
				}
			}
		}
	}
}
 
開發者ID:GelandiAssociation,項目名稱:EscapeLag,代碼行數:24,代碼來源:AntiSpam.java

示例2: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.LOWEST)
public void onSignChange(SignChangeEvent event){
	if(event.getLine(0).equalsIgnoreCase("[private]")){
			boolean door = checkForDoor(event.getBlock());
			if(!door){
				event.setLine(0, "Only doors can");
				event.setLine(1, "be locked.");
			}
	}
	if(event.getBlock().getType().equals(Material.WALL_SIGN) || event.getBlock().getType().equals(Material.SIGN_POST) || event.getBlock().getType().equals(Material.SIGN)){
		if(event.getLine(0).toLowerCase().contains("private") && (doors.contains(event.getBlock().getRelative(-1, 1, 0).getType()) || doors.contains(event.getBlock().getRelative(1, 1, 0).getType()) || doors.contains(event.getBlock().getRelative(0, 1, -1).getType()) || doors.contains(event.getBlock().getRelative(0, 1, 1).getType()))) {
			event.setLine(0, "[?]");
			event.setCancelled(true);
			event.getPlayer().sendMessage(ChatColor.RED +"[Lockette] Conflict with an existing protected door.");
		}
	}
}
 
開發者ID:StarQuestMinecraft,項目名稱:StarQuestCode,代碼行數:18,代碼來源:LocketteVault.java

示例3: onSignChangeEvent

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.NORMAL)
public void onSignChangeEvent(SignChangeEvent event) {
    
    final String signCommand = plugin.getConfig().getString("settings.signCommand");
    if (event.getLine(0).equalsIgnoreCase(signCommand)) {
        
        Account account = PickleXPBank.getInstance().getAccountManager().getAccount(event.getPlayer().getUniqueId());
        
        if (account.canPlaceXPSign()) {        
                XPSign xPSign = XPSignFactory.createXPSign(event.getBlock().getLocation(), account);
                PickleXPBank.getInstance().getAccountManager().addXPSign(xPSign);
        }
        else {
            event.setCancelled(true);
        }
        
    }
    /*else {
        //Incase a plugin modifies the sign
        XPSign xpSign = PickleXPBank.getInstance().getAccountManager().getXPSign((Sign)event.getBlock().getState());
        if (xpSign != null) {
            PickleXPBank.getInstance().getAccountManager().removeXPSign(xpSign);
        }
        
    }*/
}
 
開發者ID:Curtisdhi,項目名稱:PickleXPBank,代碼行數:27,代碼來源:XPSignListener.java

示例4: signChanged

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
public void signChanged(SignChangeEvent event) {
	Player player = event.getPlayer();
	String[] lines = event.getLines();
	Block block = event.getBlock();

	if (event.getLine(0).toLowerCase().equals("[ems]")) {
		// Only process the sign if the player has an edit session open
		EMSEditState editState = getArenaEditState(player, true);
		if (editState == null) {
			player.sendMessage(ChatColor.RED + "[EMS] Fatal error while getting edit state");
			return;
		}

		String arenaName = event.getLine(1);
		EMSArena arena = getArena(arenaName);
		if (arena == editState.arena) {
			if (arena.signUpdated(block, lines)) {
				player.sendMessage(ChatColor.GREEN + "Created join sign");
				event.setCancelled(true);
			}
		} else {
			player.sendMessage(ChatColor.RED + "[EMS] Tried to create sign for " + arena.getName() + " but arena in edit was " + editState.arena.getName());
		}
	}
}
 
開發者ID:basicmark,項目名稱:EMS,代碼行數:26,代碼來源:EMSManager.java

示例5: signCreate

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void signCreate(SignChangeEvent e) {
	if(e.getLine(0).contains("[free]")) {
		if(e.getPlayer().hasPermission(PermissionKey.SIGN_FREE.getPermission())) {
			if(e.getLine(1).isEmpty()) {
				sendMessage(e.getPlayer(), ChatColor.GREEN + "you have successfully placed a free sign, now right click the sign with your selected block");
				e.setLine(0, ChatColor.DARK_BLUE + e.getLine(0));
				return;
			} else {
				sendMessage(e.getPlayer(), ChatColor.RED + "you have to leave the second line empty, and put the block with right click in the sign");
				e.setCancelled(true);
			}
		} else {
			sendMessage(e.getPlayer(), ChatColor.RED + "you don't have permission to place these type signs");
			e.setCancelled(true);
		}
	} else {
		return;
	}
}
 
開發者ID:xEssentials,項目名稱:xEssentials-deprecated-bukkit,代碼行數:21,代碼來源:FreeSignEvent.java

示例6: onCreate

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onCreate(SignChangeEvent e) {
	if(e.getLine(0).equalsIgnoreCase("[dispense]") || e.getLine(0).equalsIgnoreCase("[dispenser]")) {
		if(e.getPlayer().hasPermission(PermissionKey.SIGN_DISPENSER_CREATE.getPermission())) {
			
			Sign sign = (Sign) e.getBlock().getState().getData();
			
			if(e.getBlock().getRelative(sign.getAttachedFace()).getType() == Material.DISPENSER) {
				e.setLine(0, ChatColor.BLUE + "[Dispense]");
				sendMessage(e.getPlayer(), ChatColor.GREEN + "you successfully placed a dispense sign!");	
			} else {
				sendMessage(e.getPlayer(), ChatColor.RED + "your sign has to be attached to a dispenser!");
				e.setCancelled(true);
			}
		} else {
			sendMessage(e.getPlayer(), ChatColor.RED + "you are not allowed to make dispense signs!");
			e.setCancelled(true);
		}
	}
}
 
開發者ID:xEssentials,項目名稱:xEssentials-deprecated-bukkit,代碼行數:21,代碼來源:DispenseSignEvent.java

示例7: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onSignChange(SignChangeEvent event) {
    Player player = event.getPlayer();
    if (StringUtils.stringContainsIgnoreCaseAndColor(event.getLine(1), LINE_RMEFFECTS)) {
        if (player.hasPermission(PERM_SIGN_PLACE_RMEFFECTS)) {
            event.setLine(1, LINE_RMEFFECTS);
        } else {
            Messaging.send(player, "signs.rmeffects.place-no-perm");
            event.setCancelled(true);
        }
    } else if (StringUtils.stringContainsIgnoreCaseAndColor(event.getLine(1), LINE_COUNTDOWN)) {
        if (player.hasPermission(PERM_SIGN_PLACE_COUNTDOWN)) {
            event.setLine(1, LINE_COUNTDOWN);
        } else {
            Messaging.send(player, "signs.countdown.place-no-perm");
            event.setCancelled(true);
        }
    } else if (StringUtils.stringContainsIgnoreCaseAndColor(event.getLine(1), LINE_RESTORE)) {
        if (player.hasPermission(PERM_SIGN_PLACE_RESTORE)) {
            event.setLine(1, LINE_RESTORE);
        } else {
            Messaging.send(player, "signs.restore.place-no-perm");
            event.setCancelled(true);
        }
    }
}
 
開發者ID:galaran,項目名稱:PvpRealm,代碼行數:27,代碼來源:PvpRealmListener.java

示例8: signCreate

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void signCreate(SignChangeEvent e) {
	if(e.getLine(0).contains("[free]")) {
		if(e.getPlayer().hasPermission("xEssentials.freesign")) {
			if(e.getLine(1).isEmpty()) {
				e.getPlayer().sendMessage(ChatColor.GREEN + "you have successfully placed a free sign, now right click the sign with your selected block");
				e.setLine(0, ChatColor.DARK_BLUE + e.getLine(0));
				return;
			} else {
				e.getPlayer().sendMessage(ChatColor.RED + "you have to leave the second line empty, and put the block with right click in the sign");
				e.setCancelled(true);
			}
		} else {
			e.getPlayer().sendMessage(ChatColor.RED + "you don't have permission to place these type signs");
			e.setCancelled(true);
		}
	} else {
		return;
	}
}
 
開發者ID:xize,項目名稱:xEssentials_old_Source,代碼行數:21,代碼來源:freeSign.java

示例9: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onSignChange(SignChangeEvent event) {
    if (event.isCancelled())return;
    Sign sign = (Sign) event.getBlock().getState();

    if (sign.getLine(0).matches("StorageSign"))/*変更拒否*/ {
        event.setLine(0, sign.getLine(0));
        event.setLine(1, sign.getLine(1));
        event.setLine(2, sign.getLine(2));
        event.setLine(3, sign.getLine(3));
        sign.update();
    } else if (event.getLine(0).equalsIgnoreCase("storagesign"))/*書き込んで生成禁止*/ {
        if (event.getPlayer().hasPermission("storagesign.create")) {
            event.setLine(0, "StorageSign");
            sign.update();
        } else {
            event.getPlayer().sendMessage(ChatColor.RED + config.getString("no-permisson"));
            event.setCancelled(true);
        }
    }
}
 
開發者ID:wackyls6,項目名稱:StorageSign,代碼行數:22,代碼來源:StorageSignCore.java

示例10: onSignChangeEvent

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH)
public void onSignChangeEvent(SignChangeEvent event) {
	if (!event.getLine(1).equalsIgnoreCase("[Quest]"))
		return;
	Player player = event.getPlayer();
	Block block = event.getBlock();
	if (!player.hasPermission("minequest.sign.placesign")) {
		player.sendMessage(ChatColor.RED + "You do not have permission to do this!");
		block.breakNaturally();
		return;
	}
	if (event.getLine(2).equalsIgnoreCase("")) {
		event.setCancelled(true);
		player.sendMessage(ChatColor.RED + "Must specify a quest!");
		block.breakNaturally();
		return;
	}
	if (Managers.getQuestManager().getDetails(event.getLine(2)) == null) {
		event.setCancelled(true);
		player.sendMessage(ChatColor.RED + "No such quest!");
		block.breakNaturally();
		return;
	}
	// oh, prettify it ;D
	event.setLine(1, ChatColor.GREEN + "[Quest]");
}
 
開發者ID:Minequest,項目名稱:Core-Bukkit,代碼行數:27,代碼來源:QuestSign.java

示例11: onTNTRunSignCreate

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onTNTRunSignCreate(SignChangeEvent e) {
	Player player = e.getPlayer();
	if (e.getLine(0).equalsIgnoreCase("[TNTRun]") || e.getLine(0).equalsIgnoreCase("§7[§6TNTRun§7]")) {
		if (!player.hasPermission("tntrun.setup")) {
			Messages.sendMessage(player, Messages.nopermission);
			e.setCancelled(true);
			e.getBlock().breakNaturally();
			return;
		}	
		String line = e.getLine(1).toLowerCase();
		if (signs.containsKey(line)) {
			signs.get(line).handleCreation(e);
		}
	}
}
 
開發者ID:ShevchikUnsupportedProjects,項目名稱:TNTRun,代碼行數:17,代碼來源:SignHandler.java

示例12: handleCreation

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@Override
public void handleCreation(SignChangeEvent e) {
	final Arena arena = plugin.amanager.getArenaByName(e.getLine(2));
	if (arena != null) {
		e.setLine(0, plugin.getConfig().getString("signs.prefix").replace("&", "§"));
		e.getPlayer().sendMessage("Sign succesfully created");
		plugin.signEditor.addSign(e.getBlock(), arena.getArenaName());
		Bukkit.getScheduler().scheduleSyncDelayedTask(plugin,
			new Runnable() {
				@Override
				public void run() {
					plugin.signEditor.modifySigns(arena.getArenaName());
				}
			}
		);
	} else {
		e.getPlayer().sendMessage("Arena does not exist");
		e.setCancelled(true);
		e.getBlock().breakNaturally();
	}
}
 
開發者ID:ShevchikUnsupportedProjects,項目名稱:TNTRun,代碼行數:22,代碼來源:JoinSign.java

示例13: SignCheckChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void SignCheckChange(SignChangeEvent event) {
    if (ConfigPatch.fixCrashSign) {
        Player player = event.getPlayer();
        String[] lines =event.getLines();
        int ll = lines.length;
        for(int i = 0;i<ll;i++){
            String line = lines[i];
            if(line.length() >= 127){
                event.setCancelled(true);
                AzureAPI.log(player, ConfigPatch.AntiCrashSignWarnMessage);
            }
        }
    }
}
 
開發者ID:GelandiAssociation,項目名稱:EscapeLag,代碼行數:16,代碼來源:AntiCrashSign.java

示例14: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
/**
 * Control sign contents
 *
 * @param event Event
 */
@EventHandler(ignoreCancelled = true)
public void onSignChange(SignChangeEvent event)
{
    for (int i = 0; i < 4; i++)
        if (event.getLine(i).matches("^[a-zA-Z0-9ÀÁÂÄÇÈÉÊËÌÍÎÏÒÓÔÖÙÚÛÜàáâäçèéêëîïôöûü &]*$") && event.getLine(i).length() > 20)
            event.setCancelled(true);
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:13,代碼來源:GameListener.java

示例15: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH)
void onSignChange(SignChangeEvent event) {
	if (!event.getPlayer().hasPermission("emojichat.use") || !event.getPlayer().hasPermission("emojichat.use.sign"))
		return; // Don't do anything if they don't have permission
	
	if (!plugin.getConfig().getBoolean("emojis-on-signs")) // Feature is disabled
		return;
	
	for (int i = 0; i < 4; i++) {
		String line = event.getLine(i);
		
		// Checks if the user disabled shortcuts via /emojichat toggle
		if (!plugin.getEmojiHandler().hasShortcutsOff(event.getPlayer())) {
			line = plugin.getEmojiHandler().translateShorthand(line);
		}
		
		// Replace shortcuts with emojis
		line = plugin.getEmojiHandler().toEmojiFromSign(line);
		
		// If the message contains a disabled character
		if (plugin.getEmojiHandler().containsDisabledCharacter(line)) {
			event.setCancelled(true);
			event.getPlayer().sendMessage(ChatColor.RED + "Oops! You can't use disabled emoji characters!");
			return;
		}
		
		event.setLine(i, line);
	}
}
 
開發者ID:RadBuilder,項目名稱:EmojiChat,代碼行數:30,代碼來源:EmojiChatListener.java


注:本文中的org.bukkit.event.block.SignChangeEvent.setCancelled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。