本文整理匯總了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);
}
}
}
}
}
示例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());
}
}
}
}
}
}
示例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);*/
}
示例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═════════");
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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());
}
}
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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 + "]");
}
示例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 + "]");
}
示例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);
}
}
}
}
示例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
}
}
}