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