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


Java SignChangeEvent.getPlayer方法代碼示例

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


在下文中一共展示了SignChangeEvent.getPlayer方法的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: changeEvent

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@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));

	}
}
 
開發者ID:SpikyBite,項目名稱:BiteSkywars,代碼行數:25,代碼來源:SignController.java

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

示例4: whenSignPlaced

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
/**
 * 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);
        }
    }
}
 
開發者ID:ProjectSandstone,項目名稱:EventoZero,代碼行數:26,代碼來源:EventListener.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: onSignChanged

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@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());
    }
}
 
開發者ID:rlf,項目名稱:uSkyBlock,代碼行數:20,代碼來源:SignEvents.java

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

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

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

示例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
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]);
			}
		}
		
		
	}
}
 
開發者ID:maker56,項目名稱:UltimateSurvivalGames,代碼行數:24,代碼來源:SignListener.java

示例12: onSignChange

import org.bukkit.event.block.SignChangeEvent; //導入方法依賴的package包/類
@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();
  }
}
 
開發者ID:Dragonzslayer,項目名稱:TeamTag-plugin,代碼行數:25,代碼來源:signListener.java

示例13: 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.ARENT_DOES_NOT_EXIST.replace("$ARENANAME$", e.getLine(1)));
					}
				}
			}
			if (e.getLine(1).equalsIgnoreCase("leave")) {
				e.setLine(0, "§6[BlockParty]");
				e.setLine(1, "§4Leave");
			}
		}
	}
}
 
開發者ID:LekoHD,項目名稱:BlockParty,代碼行數:27,代碼來源:SignListener.java

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

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


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