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


Java SignChangeEvent.getLines方法代碼示例

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


在下文中一共展示了SignChangeEvent.getLines方法的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
public void onSignChange (SignChangeEvent event) {
    if (config.isEnabled()) {
        Player player = event.getPlayer();

        if ( ! config.allowBypass(player)) {
            String[] lines = event.getLines();

            for (int index = 0; index < lines.length; index++) {
                String line = lines[index];

                if (config.getFilter().violatesPolicy(line)) {
                    String censoredLine = config.getFilter().censorMessage(line);
                    event.setLine(index, censoredLine);

                    if (logger != null) {
                        // The check above is in case the log file failed to create
                        logger.log(player, line, event.getBlock().getLocation().toString());
                    }
                }
            }
        }
    }
}
 
開發者ID:jmshal,項目名稱:meloooncensor,代碼行數:25,代碼來源:SignChangeEventListener.java

示例3: changeColor

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void changeColor(SignChangeEvent event) {
	String[] lines = event.getLines();
	
	if (lines[0].equals("[pw]"))
		event.setLine(0, ChatColor.BLUE + "PaintWar");
	else
		return;
	
	if (lines[1].equals("join")) {
		event.setLine(1, ChatColor.DARK_GREEN + "join");
	}
	/*else if (lines[1].equals("status")) {
		event.setLine(1, lines[2]);
		event.setLine(2, ChatColor.DARK_RED + "Waiting");
		event.setLine(3, ChatColor.DARK_AQUA + "0/4");
	}
	
	event.setCancelled(true);
	
	statusCreation(event);*/
}
 
開發者ID:JFischer00,項目名稱:PaintWarPlugin,代碼行數:23,代碼來源:SignsHandler.java

示例4: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onSignChange(SignChangeEvent e) {
	String[] line = e.getLines();

	if (line[0].equalsIgnoreCase("[COD]")) {
		if (StringUtils.containsIgnoreCase(line[1], "Join")) {
			e.setLine(0, "§b§m═════════");
			e.setLine(1, "§4§lCOD-Warfare");
			e.setLine(2, "§a§lJoin");
			e.setLine(3, "§b§m═════════");
		} else if (StringUtils.containsIgnoreCase(line[1], "Leave")) {
			e.setLine(0, "§b§m═════════");
			e.setLine(1, "§4§lCOD-Warfare");
			e.setLine(2, "§6§lLeave");
			e.setLine(3, "§b§m═════════");
		} else if (StringUtils.containsIgnoreCase(line[1], "Menu")) {
			e.setLine(0, "§b§m═════════");
			e.setLine(1, "§4§lCOD-Warfare");
			e.setLine(2, "§3§lMenu");
			e.setLine(3, "§b§m═════════");
		}
	}
}
 
開發者ID:frostythedev,項目名稱:COD-Warfare,代碼行數:24,代碼來源:Listeners.java

示例5: create

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@Override
public boolean create(SignChangeEvent event) {
	Player player = event.getPlayer();
	String[] args = event.getLines();
	int amount;
	Spell spell;
	try {
		amount = Integer.parseInt(args[2]);
	} catch (Exception ex) {
		Language.sendError("shop.spell.create.amount", player);
		return false;
	}
	spell = Zephyrus.getSpell(args[1]);
	if (spell == null) {
		Language.sendError("shop.spell.create.spell", player);
		return false;
	}
	Language.sendMessage("shop.spell.create.complete", player, "[SPELL]", spell.getName(), "[AMOUNT]", amount + "");
	event.setLine(2, "$" + args[2]);
	return true;
}
 
開發者ID:mcardy,項目名稱:Zephyrus-II,代碼行數:22,代碼來源:SpellShop.java

示例6: create

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@Override
public boolean create(SignChangeEvent event) {
	Player player = event.getPlayer();
	String[] args = event.getLines();
	int amount;
	Item item;
	try {
		amount = Integer.parseInt(args[2]);
	} catch (Exception ex) {
		Language.sendError("shop.item.create.amount", player);
		return false;
	}
	item = Zephyrus.getItemManager().getItemFromBaseName(args[1]);
	if (item == null) {
		Language.sendError("shop.item.create.item", player);
		return false;
	}
	Language.sendMessage("shop.item.create.complete", player, "[ITEM]", item.getName(), "[AMOUNT]", amount + "");
	event.setLine(2, "$" + args[2]);
	event.setLine(1, item.getName());
	return true;
}
 
開發者ID:mcardy,項目名稱:Zephyrus-II,代碼行數:23,代碼來源:ItemShop.java

示例7: create

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@Override
public boolean create(SignChangeEvent event) {
	Player player = event.getPlayer();
	String[] args = event.getLines();
	int amount;
	Item item;
	Wand wand;
	try {
		amount = Integer.parseInt(args[2]);
	} catch (Exception ex) {
		Language.sendError("shop.wand.create.amount", player);
		return false;
	}
	item = Zephyrus.getItemManager().getItemFromBaseName(args[1]);
	if (item == null || !(item instanceof Wand)) {
		Language.sendError("shop.wand.create.wand", player);
		return false;
	}
	wand = (Wand) item;
	Language.sendMessage("shop.wand.create.complete", player, "[WAND]", wand.getName(), "[AMOUNT]", amount + "");
	event.setLine(2, "$" + args[2]);
	event.setLine(1, wand.getName());
	return true;
}
 
開發者ID:mcardy,項目名稱:Zephyrus-II,代碼行數:25,代碼來源:WandShop.java

示例8: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH)
public void onSignChange(SignChangeEvent event) {
	if (event.getBlock() == null)
		return;
	if (event.getBlock().getState() == null)
		return;
	if(event.getLines()[0] == null)
		return;
	if (event.getLines()[0].equals("[SGJoin]")) {
		event.setLine(0, ChatColor.BLUE + "[SGJoin]");
		return;
	}

	if (event.getLines()[0].equals("[SGKit]")) {
		event.setLine(0, ChatColor.BLUE + "[SGKit]");
		return;
	}
	
	if (event.getLines()[0].equals("[SGSign]")) {
		if(event.getLines()[1] == null)
			return;
		SGApi.getSignManager().addSign(event.getBlock().getLocation(), Integer.parseInt(event.getLines()[1]));
		return;
	}
}
 
開發者ID:SurvivalGamesDevTeam,項目名稱:TheSurvivalGames,代碼行數:26,代碼來源:SignListener.java

示例9: 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

示例10: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onSignChange(final SignChangeEvent event) {
    boolean containsColors = false;
    for (final String line : event.getLines()) {
        if (line.matches(getColorsRegex())) {
            containsColors = true;
            break;
        }
    }
    if (containsColors) {
        if (Perms.hasSignColors(event.getPlayer())) {
            for (int i = 0; i < 4; i++) {
                event.setLine(i, ColorUtil.colorize(event.getLine(i)));
            }
        } else {
            this.plugin.sendMessage(event.getPlayer(), MessageId.general_signcolors_permissionDenied);
        }
    }
}
 
開發者ID:Ribesg,項目名稱:NPlugins,代碼行數:20,代碼來源:SignColorsListener.java

示例11: SignCreate

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void SignCreate(SignChangeEvent event){
	Player player = event.getPlayer();
	if(event.getLine(0).equalsIgnoreCase("[VRank]")){
		if(Main.isAuthorized(player, "VSkills.signs.rank")){
			player.sendMessage(ChatColor.RED + "You don't have the permissions to use this type of sign");
			return;
		}
		String[] line = event.getLines();
		if(Main.isInteger(line[1])){
			if(Integer.parseInt(line[1]) > 0){
				lbRank(event);
			}
		}
	}
}
 
開發者ID:cblacks26,項目名稱:VSkills,代碼行數:17,代碼來源:BlockListener.java

示例12: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onSignChange(SignChangeEvent e) {
	if (e.getLines().length > 0 && !e.getLine(0).equalsIgnoreCase("[Romball]")) return;
	if (e.getLines().length < 3) {
		e.getBlock().breakNaturally();
		MessageManager.getInstance().severe(e.getPlayer(), "A Romball sign must have 3 lines!");
		return;
	}
	
	try {
		Integer.parseInt(e.getLine(2));
	} catch (Exception ex) {
		e.getBlock().breakNaturally();
		MessageManager.getInstance().severe(e.getPlayer(), e.getLine(2) + "is not a valid number!");
		return;
	}
	
	e.setLine(0, ChatColor.GREEN + "[" + ChatColor.AQUA + "Romball" + ChatColor.GREEN + "]");
}
 
開發者ID:wdolezal5,項目名稱:Romball,代碼行數:20,代碼來源:LobbySign.java

示例13: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onSignChange(SignChangeEvent e) {
	if (e.getLines().length > 0 && !e.getLine(0).equalsIgnoreCase("[PogoBall]")) return;
	if (e.getLines().length < 3) {
		e.getBlock().breakNaturally();
		MessageManager.getInstance().severe(e.getPlayer(), "A PogoBall sign must have at least 3 lines.");
		return;
	}
	
	try { Integer.parseInt(e.getLine(2)); }
	catch (Exception ex) {
		e.getBlock().breakNaturally();
		MessageManager.getInstance().severe(e.getPlayer(), e.getLine(2) + " is not a valid number!");
		return;
	}
	
	e.setLine(0, ChatColor.GREEN + "[" + ChatColor.BLUE + "PogoBall" + ChatColor.GREEN + "]");
}
 
開發者ID:nrubin29,項目名稱:pogoball,代碼行數:19,代碼來源:LobbySign.java

示例14: 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

示例15: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public final void onSignChange(SignChangeEvent event) {

	String[] lines = event.getLines();
	Player player = (Player) event.getPlayer();

	if (!player.hasPermission("emojix.sign.use"))
		return;

	/*
	 * This loop allows detection for emotes mixed with words and also
	 * eliminates emotes appearing in URL's - emotes must have a space on
	 * both sides if applicable
	 */
	for (Object obj : EmojiConfig.emoji.getConfigurationSection("emoji").getKeys(false)) {
		for (int i = 0; i < lines.length; i++) {

			String[] words = lines[i].split(" ");

			// If player has colored prefix we obtain that color
			String color = ChatColor.getLastColors(words[0]);

			for (String word : words) {

				// This is so the user can use an emoji singularly or at the start of line
				if (word == words[0])
					word = ChatColor.stripColor(word);

				if (word.equals(obj.toString()) && player.hasPermission("emojix.chat." + word))
					lines[i] = lines[i].replace(word,
							ChatColor.RESET + EmojiConfig.emoji.getString("emoji." + obj.toString()) + color);
			}

			event.setLine(i, lines[i]);
			// TODO: Plugin works as intended - 1. Fix any bugs should they occur 2. Add extra functionality
		}
	}
}
 
開發者ID:pphelix,項目名稱:emojix-spigot,代碼行數:39,代碼來源:SignEvent.java


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