SteamWar/BauSystem
Archiviert
13
0

Skull + colored Signs

Dieser Commit ist enthalten in:
Lixfel 2019-07-14 20:07:46 +02:00
Ursprung 96d51b3c0e
Commit fcc76ae559
4 geänderte Dateien mit 47 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -76,6 +76,7 @@ public class BauSystem extends JavaPlugin implements Listener {
getCommand("bau").setExecutor(new CommandBau()); getCommand("bau").setExecutor(new CommandBau());
getCommand("bauinfo").setExecutor(new CommandInfo()); getCommand("bauinfo").setExecutor(new CommandInfo());
getCommand("protect").setExecutor(new CommandProtect()); getCommand("protect").setExecutor(new CommandProtect());
getCommand("skull").setExecutor(new CommandSkull());
Bukkit.getPluginManager().registerEvents(this, this); Bukkit.getPluginManager().registerEvents(this, this);
Bukkit.getPluginManager().registerEvents(new RegionListener(), this); Bukkit.getPluginManager().registerEvents(new RegionListener(), this);

Datei anzeigen

@ -0,0 +1,34 @@
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
public class CommandSkull implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
if(!(commandSender instanceof Player))
return false;
Player p = (Player) commandSender;
if(args.length != 1){
p.sendMessage(BauSystem.PREFIX + "§8/§eskull §8[§eSpieler§8]");
return false;
}
ItemStack is = new ItemStack(Material.SKULL_ITEM, 1, (short)0, (byte)3);
SkullMeta sm = (SkullMeta)is.getItemMeta();
sm.setOwner(args[0]);
sm.setDisplayName("§e" + args[0] + "§8s Kopf");
is.setItemMeta(sm);
p.getInventory().setItemInMainHand(is);
return false;
}
}

Datei anzeigen

@ -5,14 +5,12 @@ import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.Permission;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.*;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
@ -77,4 +75,13 @@ public class RegionListener implements Listener {
if(!BauSystem.getWelt().isFireDmg()) if(!BauSystem.getWelt().isFireDmg())
e.setCancelled(true); e.setCancelled(true);
} }
@EventHandler
public void onSignChange(SignChangeEvent event) {
for(int i = 0; i <= 3; ++i) {
String line = event.getLine(i);
line = ChatColor.translateAlternateColorCodes('&', line);
event.setLine(i, line);
}
}
} }

Datei anzeigen

@ -14,5 +14,6 @@ commands:
protect: protect:
bauinfo: bauinfo:
speed: speed:
skull:
nightvision: nightvision:
aliases: nv aliases: nv