本文整理匯總了Java中org.bukkit.event.block.SignChangeEvent類的典型用法代碼示例。如果您正苦於以下問題:Java SignChangeEvent類的具體用法?Java SignChangeEvent怎麽用?Java SignChangeEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SignChangeEvent類屬於org.bukkit.event.block包,在下文中一共展示了SignChangeEvent類的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);
}
}
}
}
}
示例2: onSignChangeEvent
import org.bukkit.event.block.SignChangeEvent; //導入依賴的package包/類
@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();
}
}
}
}
}
}
示例3: 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'");
}
}
示例4: 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));
}
}
示例5: 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());
}
}
}
}
}
}
示例6: 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");
}
}
示例7: onSignChange
import org.bukkit.event.block.SignChangeEvent; //導入依賴的package包/類
@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;
}
}
}
示例8: 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);*/
}
示例9: onSignChange
import org.bukkit.event.block.SignChangeEvent; //導入依賴的package包/類
@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);
}
}
}
}
}
示例10: onSignChange
import org.bukkit.event.block.SignChangeEvent; //導入依賴的package包/類
@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);
}
}
示例11: onSignChange
import org.bukkit.event.block.SignChangeEvent; //導入依賴的package包/類
/**
* 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();
}
示例12: createVault
import org.bukkit.event.block.SignChangeEvent; //導入依賴的package包/類
/**
* 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);
}
}
}
示例13: 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);
}
}
}
示例14: 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");
}
}
}
}
示例15: 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")));
}
}
}