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


Java SignChangeEvent.setLine方法代碼示例

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


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

示例1: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onSignChange(SignChangeEvent e) {
    if (e.getLine(0).equalsIgnoreCase("[Elevator]") && e.getLine(1).equalsIgnoreCase("Up")) {
        e.setLine(0, ChatColor.RED + "[Elevator]");
        e.setLine(1, ChatColor.DARK_GRAY + "Up");
        return;
    }
    if (e.getLine(0).equalsIgnoreCase("[Elevator]") && e.getLine(1).equalsIgnoreCase("Down")) {
        e.setLine(0, ChatColor.RED + "[Elevator]");
        e.setLine(1, ChatColor.DARK_GRAY + "Down");
        return;
    }
    if(e.getLine(0).equalsIgnoreCase("[Elevator]")) {
    	e.setLine(0, ChatColor.RED.toString() + ChatColor.BOLD + "ERROR");
    	e.setLine(1, ChatColor.GRAY + "Use 'Up'");
    	e.setLine(2, ChatColor.GRAY + "or");
    	e.setLine(3, "'Down'");
    }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:20,代碼來源:ElevatorListener.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: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onSignChange(SignChangeEvent e){
	if(e.getLine(1).equalsIgnoreCase("[join]")){
		if(e.getLine(2).equalsIgnoreCase("green")){
			e.setLine(1,"Join");
			e.setLine(2, ChatColor.GREEN + "Green");
		}
		else if(e.getLine(2).equalsIgnoreCase("red")){
			e.setLine(1,"Join");
			e.setLine(2, ChatColor.RED + "Red");
		}
	}
	else if(e.getLine(1).equalsIgnoreCase("[spectate]")){
		e.setLine(1,ChatColor.BLUE + "Spectate");
		e.setLine(2, ChatColor.BLUE + "or use /spectate");
	}
}
 
開發者ID:letsgo00,項目名稱:CubeKrowd-Icerunner,代碼行數:18,代碼來源:SignManager.java

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

示例5: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onSignChange(SignChangeEvent e) {
	Player p = e.getPlayer();
	if (p.hasPermission("blockparty.admin")) {
		if (e.getLine(0).equalsIgnoreCase("[BlockParty]")) {
			if (e.getLine(1).equalsIgnoreCase("join")) {
				if (e.getLine(2) != null) {
					if (BlockParty.getArena.containsKey(e.getLine(2))) {
						String arenaName = e.getLine(2);
						e.setLine(0, "�6[BlockParty]");
						e.setLine(1, "�7Arena:");
						e.setLine(2, ChatColor.AQUA + arenaName);
						e.setLine(3, "�2Join");
						BlockParty.signs.put(arenaName, (Sign) e.getBlock().getState());
					} else {
						p.sendMessage(BlockParty.messageManager.ARENA_DOES_NOT_EXIST.replace("$ARENANAME$", e.getLine(1)));
					}
				}
			}
			if (e.getLine(1).equalsIgnoreCase("leave")) {
				e.setLine(0, "�6[BlockParty]");
				e.setLine(1, "�4Leave");
			}
		}
	}
}
 
開發者ID:Hansdekip,項目名稱:BlockParty-1.8,代碼行數:27,代碼來源:SignListener.java

示例6: checkUpdateJoin

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
public void checkUpdateJoin(SignChangeEvent e) {

        if (e.getLine(0).equalsIgnoreCase(plugin.getConfig().getString("signs.first-line-text"))) {
            e.setLine(0, joinSignFirstLine);
            String arenaName = e.getLine(1);
            final ArenaManager.Arena arena = plugin.am.getArena(arenaName);
            if (arena != null) {
                plugin.am.addJoinSign(arenaName, e.getBlock().getLocation());
                Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
                        @Override
                        public void run() {
                            arena.updateSigns();
                        }
                    }, 2);
            } else {
                e.setLine(2, ChatColor.translateAlternateColorCodes('&',
                        plugin.getConfig().getString("signs.on-invalid-arena-replacement")));
            }
        }
    }
 
開發者ID:ddonofrio,項目名稱:libelula,代碼行數:21,代碼來源:SignManager.java

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

示例8: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onSignChange(SignChangeEvent event) {
   if (!(event.getPlayer().isOp() && event.getPlayer().getGameMode() == GameMode.CREATIVE)) {
      return;
   }
   if (event.getLine(0).equalsIgnoreCase("Server")) {
      String server = event.getLine(1);

      event.setLine(0, ChatColor.GOLD + "" + ChatColor.BOLD + "[ Server ]");
      event.setLine(1, event.getLine(2));
      event.setLine(2, "");
      event.setLine(3, ChatColor.BOLD + "Click to join");

      plugin.getConfig().set("Servers." + Utils.getStringBlock(event.getBlock().getLocation()), server);
      plugin.saveConfig();
   }
}
 
開發者ID:PaulBGD,項目名稱:MiniMiniGames,代碼行數:18,代碼來源:PlayerListener.java

示例9: placeRoomSign

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
public static void placeRoomSign(SignChangeEvent e) throws RoomSignInRoomException {
	Player p = e.getPlayer();

	//Sign Lines
	String Line2 = ChatColor.stripColor(e.getLine(1)).trim();
	String Line3 = ChatColor.stripColor(e.getLine(2)).trim();
	String Line4 = ChatColor.stripColor(e.getLine(3)).trim();

	Sign sign = (Sign) e.getBlock().getState();

	if (!Line3.contains(":")) {
		Mes.mes(p, "chat.sign.place.noSeparator");
		e.setLine(0, ChatColor.DARK_RED + "]Hotels[");
		return;
	}

	String[] Line3parts = Line3.split(":");

	if (createRoomSign(sign, p, Line2, Line3parts[0], Line4, Line3parts[1]))
		Mes.mes(p, "chat.sign.place.success");
	else {
		sign.setLine(0, ChatColor.DARK_RED + "]Hotels[");
		sign.update();
	}
}
 
開發者ID:gvlfm78,項目名稱:BukkitHotels,代碼行數:26,代碼來源:HTSignManager.java

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

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

示例12: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onSignChange(SignChangeEvent event) {
	// A Murder-sign? Change and save it!
	if (event.getLine(0).trim().equalsIgnoreCase("Murder")) {
		for (int i = 1; i < 100; i++) {
			if (event.getLine(2).equalsIgnoreCase("mcm join " + i) && event.getPlayer().isOp()) {
				event.setLine(0, ChatColor.GREEN + "[Murder]");
				event.setLine(1, "");
				event.setLine(2, ChatColor.RED + "0  / " + maxPlayers);
				event.setLine(3, ChatColor.BLUE + "A" + i + ": " + event.getLine(3));
				List<Double> listPosition = Arrays.asList(event.getBlock().getLocation().getX(), event.getBlock().getLocation().getY(), event.getBlock().getLocation().getZ());
				getConfig().set("maps." + i + ".signWorld", event.getPlayer().getWorld().getName());
				getConfig().set("maps." + i + ".sign", listPosition);
				saveConfig();
				loadConfig();
			}
		}
	}

	// A Murder-lobby-sign? Change and save it!
	if (event.getLine(0).equalsIgnoreCase("Murder") && event.getLine(2).equalsIgnoreCase("mcm lobby") && event.getPlayer().isOp()) {
		event.setLine(0, ChatColor.GREEN + "[Murder]");
		event.setLine(2, ChatColor.DARK_GREEN + "--> Lobby <--");
	}
}
 
開發者ID:MarvinMenzerath,項目名稱:MC-Murder,代碼行數:26,代碼來源:Murder.java

示例13: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onSignChange(SignChangeEvent e)
{
    for (int i = 0; i < 4; i++) {
        String[] splitLine = (e.getLine(i) + " ").split("&");
        String newLine = splitLine[0];
        for (int j = 1; j < splitLine.length; j++) {
            if (splitLine[j].length() == 0
                    || CHARS.indexOf(splitLine[j].charAt(0)) == -1) {

                newLine += "&";
            }
            else {
                newLine += "\u00A7";
            }
            newLine += splitLine[j];
        }
        e.setLine(i, newLine);
    }
}
 
開發者ID:sabersamus,項目名稱:Bytecraft,代碼行數:21,代碼來源:SignColorListener.java

示例14: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@EventHandler
public void onSignChange(SignChangeEvent e)
{
    for (int i = 0; i < 4; i++) {
        String[] splitLine = (e.getLine(i) + " ").split("#");
        String newLine = splitLine[0];
        for (int j = 1; j < splitLine.length; j++) {
            if (splitLine[j].length() == 0
                    || CHARS.indexOf(splitLine[j].charAt(0)) == -1) {

                newLine += "#";
            }
            else {
                newLine += "\u00A7";
            }
            newLine += splitLine[j];
        }
        e.setLine(i, newLine);
    }
}
 
開發者ID:EmilHernvall,項目名稱:tregmine,代碼行數:21,代碼來源:SignColorListener.java

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


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