Java 类org.bukkit.event.block.SignChangeEvent 实例源码

项目:EscapeLag    文件:AntiSpam.java   
@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);
                }
            }
        }
    }
}
项目:MinecraftMarket-Plugin    文件:SignsListener.java   
@EventHandler
public void onSignChangeEvent(SignChangeEvent e) {
    if (plugin.getMainConfig().isUseSigns()) {
        if (e.getPlayer().hasPermission("minecraftmarket.signs")) {
            List<String> lines = Arrays.asList(e.getLines());
            if (lines.size() > 1 && lines.get(0).equals("[RecentDonor]") && Utils.isInt(lines.get(1))) {
                int order = Utils.getInt(lines.get(1));
                if (order > 0) {
                    if (plugin.getSignsConfig().addDonorSign(order, e.getBlock())) {
                        e.getPlayer().sendMessage(Colors.color(I18n.tl("prefix") + " " + I18n.tl("sign_added")));
                        plugin.getSignsTask().updateSigns();
                    }
                }
            }
        }
    }
}
项目:HCFCore    文件:ElevatorListener.java   
@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'");
    }
}
项目:HCFCore    文件:ElevatorListener.java   
@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'");
    }
}
项目:BiteSkywars    文件:SignController.java   
@EventHandler
public void changeEvent(SignChangeEvent event){

    if(event.getLine(0).equalsIgnoreCase("[SW]")){
        Player p = event.getPlayer();
        ArenaManager am = new ArenaManager();
        if(!p.hasPermission("skywars.sign")){
            event.getBlock().breakNaturally();
            p.sendMessage(Skywars.p + "�cYou dont have permissions");
            return;
        }
        if(!am.exist(event.getLine(1))){
            event.getBlock().breakNaturally();
            p.sendMessage(Skywars.p + "�cThis arena name not found!");
            return;
        }

           Skywars.signs.getConfig().set("signs."+event.getLine(1), am.setLoc(event.getBlock().getLocation()));
        Skywars.signs.save();

        p.sendMessage(Skywars.p + "�aSign created successful for arena "+ event.getLine(1));

    }
}
项目:meloooncensor    文件:SignChangeEventListener.java   
@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());
                    }
                }
            }
        }
    }
}
项目:CubeKrowd-Icerunner    文件:SignManager.java   
@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");
    }
}
项目:Steel    文件:LobbyListener.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void onSignChange(SignChangeEvent event) {
    for (Map.Entry<String, Minigame> e : SteelCore.getMinigames().entrySet()) {
        if (event.getLine(0).equalsIgnoreCase("[" + e.getKey() + "]")) {
            if (e.getValue().getConfigValue(ConfigNode.ENABLE_LOBBY_WIZARD)) {
                if (event.getPlayer().hasPermission(e.getKey() + ".lobby.create")
                        || event.getPlayer().hasPermission(e.getKey() + ".lobby.*")) {
                    IWizardManager wm = ((SteelMinigame) e.getValue()).getLobbyWizardManager();
                    if (!wm.hasPlayer(event.getPlayer().getUniqueId())) {
                        wm.addPlayer(event.getPlayer().getUniqueId(),
                                LocationHelper.convertLocation(event.getBlock().getLocation()));
                    } else {
                        event.getPlayer().sendMessage(ChatColor.RED + "You are already in a lobby sign wizard");
                    }
                } else {
                    event.getPlayer().sendMessage(ChatColor.RED + "You do not have permission to do this");
                }
            }
            return;
        }
    }
}
项目:BiteSkywars    文件:SignController.java   
@EventHandler
public void changeEvent(SignChangeEvent event){

    if(event.getLine(0).equalsIgnoreCase("[SW]")){
        Player p = event.getPlayer();
        ArenaManager am = new ArenaManager();
        if(!p.hasPermission("skywars.sign")){
            event.getBlock().breakNaturally();
            p.sendMessage(Skywars.p + "�cYou dont have permissions");
            return;
        }
        if(!am.exist(event.getLine(1))){
            event.getBlock().breakNaturally();
            p.sendMessage(Skywars.p + "�cThis arena name not found!");
            return;
        }

           Skywars.signs.getConfig().set("signs."+event.getLine(1), am.setLoc(event.getBlock().getLocation()));
        Skywars.signs.save();

        p.sendMessage(Skywars.p + "�aSign created successful for arena "+ event.getLine(1));

    }
}
项目:PaintWarPlugin    文件:SignsHandler.java   
@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);*/
}
项目:RageMode    文件:EventListener.java   
@EventHandler
public void onSignChange(SignChangeEvent event) {
    Sign sign = (Sign) event.getBlock().getState();

    if (event.getPlayer().hasPermission("ragemode.admin.signs")) {
        if (event.getLine(1).trim().equalsIgnoreCase("[rm]")
                || event.getLine(1).trim().equalsIgnoreCase("[ragemode]")) {
            String[] allGames = GetGames.getGameNames(PluginLoader.getInstance().getConfig());
            for (String game : allGames) {
                if (event.getLine(2).trim().equalsIgnoreCase(game.trim())) {
                    SignCreator.createNewSign(sign, game);
                    SignCreator.updateSign(event);
                }
            }
        }
    }
}
项目:TimeIsMoney    文件:ATM.java   
@EventHandler
public void onSignChange(final SignChangeEvent e) {
    final Block b = e.getBlock();
    if (b.getType() == Material.WALL_SIGN || b.getType() == Material.SIGN || b.getType() == Material.SIGN_POST) {
        plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> {
            if (b.getType() == Material.WALL_SIGN || b.getType() == Material.SIGN || b.getType() == Material.SIGN_POST) {
                Sign sign = (Sign) e.getBlock().getState();
                if (sign.getLine(0).equalsIgnoreCase("[atm]")) {
                    if (!e.getPlayer().hasPermission("tim.atm.place")) {
                        e.getPlayer().sendMessage(CC("&cYou dont have permissions to build ATM's!"));
                        sign.setLine(0, "");
                    } else {
                        sign.setLine(0, CC("&cATM"));
                        sign.update();
                        e.getPlayer().sendMessage(CC("&2ATM created! (You can also write something in the Lines 2-4)"));
                    }
                }
            }
        }, 10L);
    }
}
项目:buildinggame    文件:JoinSignCreate.java   
/**
    * Called whenever a sign's text has been changed; if it's a join sign it will be added
    *
    * @param e the event that occurred
    * @since 2.1.0
    */
   @Contract("null -> fail")
@EventHandler
public void onSignChange(SignChangeEvent e) {
    YamlConfiguration signs = SettingsManager.getInstance().getSigns();

    if (!e.getLine(0).equalsIgnoreCase("[buildinggame]"))
        return;
    if (!e.getLine(1).equalsIgnoreCase("join"))
        return;

    int number = signs.getKeys(false).size();

    signs.set(number + ".arena", e.getLine(2));
    signs.set(number + ".world", e.getBlock().getLocation().getWorld().getName());
    signs.set(number + ".x", e.getBlock().getLocation().getBlockX());
    signs.set(number + ".y", e.getBlock().getLocation().getBlockY());
    signs.set(number + ".z", e.getBlock().getLocation().getBlockZ());
    SettingsManager.getInstance().save();

       JoinSign.load();
}
项目:Gringotts-    文件:AccountListener.java   
/**
 * Create an account chest by adding a sign marker over it.
 * 
 * @param event Event data.
 */
@EventHandler
public void createVault(SignChangeEvent event) {
    String line0 = event.getLine(0);

    Matcher match = vaultPattern.matcher(line0);

    // consider only signs with proper formatting
    if (match.matches()) {
        String type = match.group(1).toLowerCase();

        // default vault is player
        if (type.isEmpty()) type = "player";

        // is sign attached to a valid vault container?
        BlockState signBlock = event.getBlock().getState();
        if (signBlock instanceof Sign &&
                Util.chestBlock((Sign)signBlock) != null) {

            // we made it this far, throw the event to manage vault creation
            VaultCreationEvent creation = new PlayerVaultCreationEvent(type, event);
            Bukkit.getServer().getPluginManager().callEvent(creation);
        }
    }
}
项目:EventoZero    文件:EventListener.java   
/**
 * Evento chamado quando uma placa é colocada OU modificada
 *
 * TODO: verificar se se trata de uma placa de evento TODO: verificar se o
 * jogador tem permissão para criar placa de evento TODO: verificar se o
 * evento existe
 */
@EventHandler(priority = EventPriority.MONITOR)
public void whenSignPlaced(final SignChangeEvent event) {
    final Player sender = event.getPlayer();
    final br.com.blackhubos.eventozero.factory.EventHandler eventHandler = EventoZero.getEventHandler();
    if (sender.isOp()) {
        Optional<Event> optional = eventHandler.getEventByName(event.getLine(0));
        if (optional.isPresent()) {
            Event eventz = optional.get();
            eventz.getSignsLocation().add(event.getBlock().getLocation());
            Bukkit.getScheduler().runTaskLater(EventoZero.getInstance(), new Runnable() {
                @Override
                public void run() {
                    eventz.updateSigns();
                }
            }, 20);
        }
    }
}
项目:BlockParty-1.8    文件:SignListener.java   
@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");
            }
        }
    }
}
项目:libelula    文件:SignManager.java   
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")));
            }
        }
    }
项目:COD-Warfare    文件:Listeners.java   
@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═════════");
        }
    }
}
项目:MiniMiniGames    文件:PlayerListener.java   
@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();
   }
}
项目:uSkyBlock    文件:SignEvents.java   
@EventHandler(priority = EventPriority.MONITOR)
public void onSignChanged(SignChangeEvent e) {
    if (e.isCancelled() || e.getPlayer() == null
            || !plugin.isSkyAssociatedWorld(e.getPlayer().getWorld())
            || !e.getLines()[0].equalsIgnoreCase("[usb]")
            || e.getLines()[1].trim().isEmpty()
            || !hasPermission(e.getPlayer(), "usb.island.signs.place")
            || !(e.getBlock().getType() == Material.WALL_SIGN)
            || !(e.getBlock().getState() instanceof Sign)
            ) {
        return;
    }
    Sign sign = (Sign) e.getBlock().getState();
    org.bukkit.material.Sign data = (org.bukkit.material.Sign) sign.getData();
    Block wallBlock = sign.getBlock().getRelative(data.getAttachedFace());
    if (isChest(wallBlock)) {
        logic.addSign(sign, e.getLines(), (Chest) wallBlock.getState());
    }
}
项目:defend-the-village    文件:Main.java   
@EventHandler(priority=EventPriority.HIGHEST)
public void onChange(SignChangeEvent ev) {
    if (ev.getLine(0).equals("[dlv]")) {
        int aId = 0;

        // Check that the ID is a integer
        try {
            aId = Integer.parseInt(ev.getLine(1));
        } catch (Exception e) {
            s(ev.getPlayer(), "La ID no es un numero.");
            return;
        }

        // That integer is a valid arena?
        if (isArena(aId)) {
            this.am.setArenaSetup(aId, "sign", this.am.serializeLoc(ev.getBlock().getLocation()));
            reloadArena(aId);
            s(ev.getPlayer(), "Configurado correctamente \"sign\" a \"" + this.am.serializeLoc(ev.getBlock().getLocation()) + "\".");
        } else {
            s(ev.getPlayer(), "No existe ninguna arena con esa ID.");
        }
    }
}
项目:BukkitHotels    文件:HTSignManager.java   
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();
    }
}
项目:Zephyrus-II    文件:SpellShop.java   
@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;
}
项目:Zephyrus-II    文件:CoreShopManager.java   
@EventHandler
public void onSignCreate(SignChangeEvent event) {
    for (Shop shop : shops) {
        if (event.getLine(0).equalsIgnoreCase("[" + shop.getName() + "]")) {
            if (Zephyrus.getHookManager().getEconomyHook() == null) {
                Language.sendError("shop.create.noeconomy", event.getPlayer());
                return;
            }
            if (!event.getPlayer().hasPermission("zephyrus.shop.create")) {
                Language.sendError("shop.permission", event.getPlayer());
                return;
            }
            if (shop.create(event)) {
                event.setLine(0, shop.getChatColorIdentifier() + "[" + shop.getName() + "]");
            }
        }
    }
}
项目:Zephyrus-II    文件:ItemShop.java   
@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;
}
项目:Zephyrus-II    文件:WandShop.java   
@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;
}
项目:UltimateSurvivalGames    文件:SignListener.java   
@EventHandler
public void onSignChange(SignChangeEvent event) {
    Player p = event.getPlayer();

    if(event.getLine(0).equalsIgnoreCase("[SurvivalGames]")) {

        if(!PermissionHandler.hasPermission(p, Permission.LOBBY)) {
            p.sendMessage(MessageHandler.getMessage("no-permission"));
            event.getBlock().breakNaturally();
            return;
        }

        if(event.getLine(1).equalsIgnoreCase("join") ) {
            SurvivalGames.signManager.addSign(p, event.getBlock().getLocation(), event.getLine(2));
        } else if(event.getLine(1).equalsIgnoreCase("quit") || event.getLine(1).equalsIgnoreCase("leave")) {
            for(int i = 0; i < sm.getLeaveSignDesign().length; i++) {
                event.setLine(i, sm.getLeaveSignDesign()[i]);
            }
        }


    }
}
项目:The-Plague    文件:CreationListener.java   
@EventHandler
public void onSignChange(SignChangeEvent event) {
    Location l = event.getBlock().getLocation();
    if (event.getPlayer().hasPermission("theplague.arena.signPlace"))
        if (event.getLine(0).equalsIgnoreCase("[ThePlague]") || event.getLine(0).equalsIgnoreCase("[Plague]")) {
            if (event.getLine(1).equalsIgnoreCase("arena")) {
                String arenaName = event.getLine(2);
                if (Arenas.findByName(arenaName) == null) {
                    ChatHelper.sendToPlayer(event.getPlayer(), ChatColor.GOLD + "There is no arena by the name of " + arenaName + "!");
                    return;
                }
                ArenaSign arenaSign = new ArenaSign(l, Arenas.findByName(arenaName));
                Signs.addSign(arenaSign);
            }
        }
}
项目:StarQuestCode    文件:LocketteVault.java   
@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.");
        }
    }
}
项目:PickleXPBank    文件:XPSignListener.java   
@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);
        }

    }*/
}
项目:TeamTag-plugin    文件:signListener.java   
@EventHandler
  public void onSignChange(SignChangeEvent event)
  {
    Player p = event.getPlayer();
    Sign sign = (Sign)event.getBlock();

    if (event.getLine(0).equalsIgnoreCase("[TeamTag]"))
    {
      if (!(p.hasPermission("TeamTag.admin.sign.place"))&&(!(p.hasPermission("TeamTag.admin.*")))&&(!(p.isOp()))) {
        return;
      }
          sign.setLine(0, "§3[TeamTag]");
          if (event.getLine(2).equalsIgnoreCase("Auto Assign")){
              sign.setLine(2, "§6Auto §2Assign");
          }
          if (event.getLine(2).equalsIgnoreCase("Join Red")){
              sign.setLine(2, "§LJoin §r§4Red");
          }
          if (event.getLine(2).equalsIgnoreCase("Join Blue")){
              sign.setLine(2, "§LJoin §r§1Blue");
          }
          sign.update();
  }
}
项目:TheSurvivalGames    文件:SignListener.java   
@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;
    }
}
项目:Bytecraft    文件:SignColorListener.java   
@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);
    }
}
项目:BlockParty    文件:SignListener.java   
@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.ARENT_DOES_NOT_EXIST.replace("$ARENANAME$", e.getLine(1)));
                    }
                }
            }
            if (e.getLine(1).equalsIgnoreCase("leave")) {
                e.setLine(0, "§6[BlockParty]");
                e.setLine(1, "§4Leave");
            }
        }
    }
}
项目:MC-Murder    文件:Murder.java   
@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 <--");
    }
}
项目:Wayward    文件:SignChangeListener.java   
@EventHandler
public void onSignChange(SignChangeEvent event) {
    if (event.getLine(0).equalsIgnoreCase("[masheekwell]")) {
        if (event.getPlayer().hasPermission("wayward.characters.createmasheekwell")) {
            event.setLine(0, ChatColor.YELLOW + "[masheekwell]");
            try {
                Integer.parseInt(event.getLine(1));
            } catch (NumberFormatException exception) {
                event.setLine(1, "20");
            }
        } else {
            event.getBlock().breakNaturally();
            event.getPlayer().sendMessage(plugin.getPrefix() + ChatColor.RED + "You do not have permission to create masheek wells.");
        }
    }
}
项目:Wayward    文件:SecretSwitchSignChangeListener.java   
@EventHandler
public void onSignChange(SignChangeEvent event) {
    if (event.getLine(0).equalsIgnoreCase("[switch]")) {
        if (!event.getPlayer().hasPermission("wayward.mechanics.secretswitch")) {
            event.getBlock().breakNaturally();
            event.getPlayer().sendMessage(plugin.getPrefix() + ChatColor.RED + "You do not have permission.");
            return;
        }
        if (!(event.getLine(1).equalsIgnoreCase("button") || event.getLine(1).equalsIgnoreCase("lever"))) {
            event.getBlock().breakNaturally();
            event.getPlayer().sendMessage(plugin.getPrefix() + ChatColor.RED + "You must specify a valid type on the second line (lever or button)");
            return;
        }
        event.setLine(0, ChatColor.BLUE + "[switch]");
    }
}
项目:EMS    文件:EMSManager.java   
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());
        }
    }
}
项目:tregmine    文件:SignColorListener.java   
@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);
    }
}
项目:NPlugins    文件:SignColorsListener.java   
@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);
        }
    }
}