SteamWar/BauSystem2.0
Archiviert
12
0

§ Colors are now ChatColors

Implementation of Redstonetester
Dieser Commit ist enthalten in:
Zeanon 2021-04-17 16:32:40 +02:00
Ursprung b3896ddb4f
Commit 8c5edd8cfe
12 geänderte Dateien mit 282 neuen und 23 gelöschten Zeilen

Datei anzeigen

@ -23,6 +23,7 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
@ -35,13 +36,13 @@ public class TeleportCommand extends SWCommand {
@Register(help = true) @Register(help = true)
public void genericHelp(Player p, String... args) { public void genericHelp(Player p, String... args) {
p.sendMessage("§8/§etp §8[§7Player§8] §8- §7Teleportiere dich zu einem Spieler"); p.sendMessage(ChatColor.DARK_GRAY + "/" + ChatColor.YELLOW + "tp " + ChatColor.DARK_GRAY + "[" + ChatColor.GRAY + "Player" + ChatColor.DARK_GRAY + "] - " + ChatColor.GRAY + "Teleportiere dich zu einem Spieler");
} }
@Register @Register
public void genericCommand(Player p, Player target) { public void genericCommand(Player p, Player target) {
if (p.getUniqueId().equals(target.getUniqueId())) { if (p.getUniqueId().equals(target.getUniqueId())) {
p.sendMessage(BauSystem.PREFIX + "§cSei eins mit dir selbst!"); p.sendMessage(BauSystem.PREFIX + ChatColor.RED + "Sei eins mit dir selbst!");
return; return;
} }
p.teleport(target, PlayerTeleportEvent.TeleportCause.COMMAND); p.teleport(target, PlayerTeleportEvent.TeleportCause.COMMAND);

Datei anzeigen

@ -26,6 +26,7 @@ import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.SWCommandUtils; import de.steamwar.command.SWCommandUtils;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -43,17 +44,17 @@ public class TimeCommand extends SWCommand {
@Register(help = true) @Register(help = true)
public void genericHelp(Player p, String... args) { public void genericHelp(Player p, String... args) {
p.sendMessage("§8/§etime §8<§7Zeit 0=Morgen§8, §76000=Mittag§8, §718000=Mitternacht§8> §8- §7Setzt die Zeit auf dem Bau"); p.sendMessage(ChatColor.DARK_GRAY + "/" + ChatColor.YELLOW + "time " + ChatColor.DARK_GRAY + "<" + ChatColor.GRAY + "Zeit 0=Morgen" + ChatColor.DARK_GRAY + ", " + ChatColor.GRAY + "6000=Mittag" + ChatColor.DARK_GRAY + ", " + ChatColor.GRAY + "18000=Mitternacht" + ChatColor.DARK_GRAY + "> - " + ChatColor.GRAY + "Setzt die Zeit auf dem Bau");
} }
@Register @Register
public void genericCommand(Player p, int time) { public void genericCommand(Player p, int time) {
if (!Permission.hasPermission(p, Permission.WORLD)) { if (!Permission.hasPermission(p, Permission.WORLD)) {
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Zeit ändern"); p.sendMessage(BauSystem.PREFIX + ChatColor.RED + "Du darfst hier nicht die Zeit ändern");
return; return;
} }
if (time < 0 || time > 24000) { if (time < 0 || time > 24000) {
p.sendMessage(BauSystem.PREFIX + "§cBitte gib eine Zahl zwischen 0 und 24000 an"); p.sendMessage(BauSystem.PREFIX + ChatColor.RED + "Bitte gib eine Zahl zwischen 0 und 24000 an");
return; return;
} }
Bukkit.getWorlds().get(0).setTime(time); Bukkit.getWorlds().get(0).setTime(time);
@ -62,7 +63,7 @@ public class TimeCommand extends SWCommand {
@Register @Register
public void genericCommand(Player p, Time time) { public void genericCommand(Player p, Time time) {
if (!Permission.hasPermission(p, Permission.WORLD)) { if (!Permission.hasPermission(p, Permission.WORLD)) {
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Zeit ändern"); p.sendMessage(BauSystem.PREFIX + ChatColor.RED + "Du darfst hier nicht die Zeit ändern");
return; return;
} }
Bukkit.getWorlds().get(0).setTime(time.getValue()); Bukkit.getWorlds().get(0).setTime(time.getValue());

Datei anzeigen

@ -20,13 +20,15 @@
package de.steamwar.bausystem.features.other; package de.steamwar.bausystem.features.other;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
@Linked(LinkageType.COMMAND)
public class WatervisionCommand extends SWCommand { public class WatervisionCommand extends SWCommand {
public WatervisionCommand() { public WatervisionCommand() {

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.other;
import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -38,7 +39,7 @@ public class WorldSpawnCommand extends SWCommand {
@Register(help = true) @Register(help = true)
public void genericHelp(Player p, String... args) { public void genericHelp(Player p, String... args) {
p.sendMessage("§8/§eworldspawn §8- §7Teleportiere dich zum Spawn"); p.sendMessage(ChatColor.DARK_GRAY + "/" + ChatColor.YELLOW + "worldspawn " + ChatColor.DARK_GRAY + "-" + ChatColor.GRAY + " Teleportiere dich zum Spawn");
} }
@Register @Register

Datei anzeigen

@ -0,0 +1,53 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.redstonetester;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.command.SWCommand;
import de.steamwar.core.VersionedRunnable;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.entity.Player;
@Linked(LinkageType.COMMAND)
public class RedstonetesterCommand extends SWCommand {
public RedstonetesterCommand() {
super("redstonetester", "rt");
}
@Register(help = true)
public void genericHelp(Player p, String... args) {
p.sendMessage(ChatColor.DARK_GRAY + "/" + ChatColor.YELLOW + "redstonetester " + ChatColor.DARK_GRAY + "-" + ChatColor.GRAY + " Gibt den RedstoneTester");
}
@Register
public void genericCommand(Player p) {
VersionedRunnable.call(new VersionedRunnable(() -> {
p.sendMessage(BauSystem.PREFIX + "Der RedstoneTester ist nicht in der 1.12 verfügbar");
}, 8), new VersionedRunnable(() -> {
p.sendMessage(BauSystem.PREFIX + "Messe die Zeit zwischen der Aktivierung zweier Redstone Komponenten");
SWUtils.giveItemToPlayer(p, RedstonetesterUtils.WAND);
}, 15));
}
}

Datei anzeigen

@ -0,0 +1,100 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.redstonetester;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import de.steamwar.inventory.SWItem;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.UtilityClass;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Powerable;
import org.bukkit.block.data.type.Piston;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@UtilityClass
public class RedstonetesterUtils {
public final ItemStack WAND = new SWItem(Material.BLAZE_ROD, ChatColor.YELLOW + "Redstonetester", Arrays.asList(ChatColor.YELLOW + "Linksklick Block " + ChatColor.DARK_GRAY + "-" + ChatColor.GRAY + " Setzt die 1. Position", ChatColor.YELLOW + "Rechtsklick Block " + ChatColor.DARK_GRAY + "-" + ChatColor.GRAY + " Setzt die 2. Position", ChatColor.YELLOW + "Shift-Rechtsklick Luft " + ChatColor.DARK_GRAY + "-" + ChatColor.GRAY + " Zurücksetzten"), false, null).getItemStack();
@Getter
private final Map<Player, RedstoneTester> playerMap = new HashMap<>();
public void sendLocation(Player player, String prefix, Location location) {
player.sendMessage(BauSystem.PREFIX + prefix + ChatColor.DARK_GRAY + ": " + ChatColor.YELLOW + locationToString(location));
}
public String locationToString(Location location) {
return location.getBlockX() + " " + location.getBlockY() + " " + location.getBlockZ();
}
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public boolean validBlock(Player player, BlockData block) {
if (block instanceof Powerable) return true;
if (block instanceof Piston) return true;
player.sendMessage(BauSystem.PREFIX + ChatColor.RED + "Unbekannte Position");
return false;
}
@Getter
@Setter
public static class RedstoneTester {
private final Player player;
private Location loc1 = null;
private Location loc2 = null;
private long lastTick = 0;
private Long tick = null;
public RedstoneTester(Player player) {
this.player = player;
}
public void activate(Location location) {
if (loc1 == null || loc2 == null) {
tick = null;
return;
}
if (loc1.equals(location)) {
if (TPSUtils.currentTick.get() - lastTick > 100) {
tick = null;
}
lastTick = TPSUtils.currentTick.get();
if (tick == null) {
tick = TPSUtils.currentTick.get();
}
return;
}
if (tick != null && loc2.equals(location)) {
player.sendMessage(BauSystem.PREFIX + "Differenz" + ChatColor.DARK_GRAY + ": " + ChatColor.YELLOW + (TPSUtils.currentTick.get() - tick) + ChatColor.DARK_GRAY + " - " + ChatColor.GRAY + "in Ticks " + ChatColor.DARK_GRAY + "(" + ChatColor.GRAY + "Ticks/2 -> Redstoneticks" + ChatColor.DARK_GRAY + ")");
}
}
}
}

Datei anzeigen

@ -0,0 +1,95 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.redstonetester;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import java.util.Objects;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.BlockRedstoneEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@Linked(LinkageType.LISTENER)
public class RestonetesterListener implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (!RedstonetesterUtils.WAND.isSimilar(event.getItem())) return;
Player player = event.getPlayer();
Block block = event.getClickedBlock();
event.setCancelled(true);
switch (event.getAction()) {
case RIGHT_CLICK_AIR:
if (player.isSneaking()) {
RedstonetesterUtils.getPlayerMap().remove(event.getPlayer());
player.sendMessage(BauSystem.PREFIX + "Positionen gelöscht" + ChatColor.DARK_GRAY + ".");
}
break;
case LEFT_CLICK_BLOCK:
if (!RedstonetesterUtils.validBlock(event.getPlayer(), Objects.requireNonNull(block).getBlockData())) return;
RedstonetesterUtils.getPlayerMap().computeIfAbsent(event.getPlayer(), RedstonetesterUtils.RedstoneTester::new).setLoc1(block.getLocation());
RedstonetesterUtils.sendLocation(event.getPlayer(), "POS1", block.getLocation());
break;
case RIGHT_CLICK_BLOCK:
if (!RedstonetesterUtils.validBlock(event.getPlayer(), Objects.requireNonNull(block).getBlockData())) return;
RedstonetesterUtils.getPlayerMap().computeIfAbsent(event.getPlayer(), RedstonetesterUtils.RedstoneTester::new).setLoc2(block.getLocation());
RedstonetesterUtils.sendLocation(event.getPlayer(), "POS2", block.getLocation());
break;
default:
break;
}
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
RedstonetesterUtils.getPlayerMap().remove(event.getPlayer());
}
@EventHandler
public void onPistonExtend(BlockPistonExtendEvent e) {
RedstonetesterUtils.getPlayerMap().forEach((player, redstoneTester) -> redstoneTester.activate(e.getBlock().getLocation()));
}
@EventHandler
public void onPistonRetract(BlockPistonRetractEvent e) {
RedstonetesterUtils.getPlayerMap().forEach((player, redstoneTester) -> redstoneTester.activate(e.getBlock().getLocation()));
}
@EventHandler
public void onRedstoneEvent(BlockRedstoneEvent e) {
RedstonetesterUtils.getPlayerMap().forEach((player, redstoneTester) -> redstoneTester.activate(e.getBlock().getLocation()));
}
@EventHandler
public void onBlockDispense(BlockDispenseEvent e) {
RedstonetesterUtils.getPlayerMap().forEach((player, redstoneTester) -> redstoneTester.activate(e.getBlock().getLocation()));
}
}

Datei anzeigen

@ -27,6 +27,7 @@ import de.steamwar.sql.Schematic;
import de.steamwar.sql.SchematicType; import de.steamwar.sql.SchematicType;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup; import de.steamwar.sql.UserGroup;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@Linked(LinkageType.COMMAND) @Linked(LinkageType.COMMAND)
@ -80,6 +81,6 @@ public class LockSchemCommand extends SWCommand {
} }
private void sendHelp(Player player) { private void sendHelp(Player player) {
player.sendMessage("§8/§eschemlock §8[§7Owner§8] §8[§7Schematic§8] §8- §7 Sperre eine Schematic"); player.sendMessage(ChatColor.DARK_GRAY + "/" + ChatColor.YELLOW + "schemlock " + ChatColor.DARK_GRAY + "[" + ChatColor.GRAY + "Owner" + ChatColor.DARK_GRAY + "] " + ChatColor.DARK_GRAY + "[" + ChatColor.GRAY + "Schematic" + ChatColor.DARK_GRAY + "] - " + ChatColor.GRAY + "Sperre eine Schematic");
} }
} }

Datei anzeigen

@ -28,6 +28,7 @@ import de.steamwar.command.SWCommandUtils;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -61,7 +62,7 @@ public class TPSLimitCommand extends SWCommand {
@Register(help = true) @Register(help = true)
public void genericHelp(Player p, String... args) { public void genericHelp(Player p, String... args) {
p.sendMessage(BauSystem.PREFIX + "Jetziges TPS limit: " + TPSLimitUtils.currentTPSLimit); p.sendMessage(BauSystem.PREFIX + "Jetziges TPS limit: " + TPSLimitUtils.currentTPSLimit);
p.sendMessage("§8/§etpslimit §8[§7TPS§8|§edefault§8] §8- §7Setzte die TPS auf dem Bau"); p.sendMessage(ChatColor.DARK_GRAY + "/" + ChatColor.YELLOW + "tpslimit " + ChatColor.DARK_GRAY + "[" + ChatColor.GRAY + "TPS" + ChatColor.DARK_GRAY + "|" + ChatColor.YELLOW + "default" + ChatColor.DARK_GRAY + "] - " + ChatColor.GRAY + "Setzte die TPS auf dem Bau");
} }
@Register({"default"}) @Register({"default"})
@ -97,17 +98,17 @@ public class TPSLimitCommand extends SWCommand {
private boolean permissionCheck(Player player) { private boolean permissionCheck(Player player) {
if (!Permission.hasPermission(player, Permission.WORLD)) { if (!Permission.hasPermission(player, Permission.WORLD)) {
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den TPS-Limiter nutzen"); player.sendMessage(BauSystem.PREFIX + ChatColor.RED + "Du darfst hier nicht den TPS-Limiter nutzen");
return false; return false;
} }
return true; return true;
} }
private void sendNewTPSLimitMessage() { private void sendNewTPSLimitMessage() {
Bukkit.getOnlinePlayers().forEach(p -> p.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§eTPS limit auf " + TPSLimitUtils.currentTPSLimit + " gesetzt."))); Bukkit.getOnlinePlayers().forEach(p -> p.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.YELLOW + "TPS limit auf " + TPSLimitUtils.currentTPSLimit + " gesetzt.")));
} }
private void sendInvalidArgumentMessage(Player player) { private void sendInvalidArgumentMessage(Player player) {
player.sendMessage(BauSystem.PREFIX + "§cNur Zahlen zwischen 0,5 und " + (TPSWarpUtils.isWarpAllowed() ? 60 : 20) + ", und 'default' erlaubt."); player.sendMessage(BauSystem.PREFIX + ChatColor.RED + "Nur Zahlen zwischen 0,5 und " + (TPSWarpUtils.isWarpAllowed() ? 60 : 20) + ", und 'default' erlaubt.");
} }
} }

Datei anzeigen

@ -23,6 +23,7 @@ import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
@ -36,17 +37,17 @@ public class NightVisionCommand extends SWCommand {
@Register(help = true) @Register(help = true)
public void genericHelp(Player p, String[] args) { public void genericHelp(Player p, String[] args) {
p.sendMessage("§8/§enightvision §8- §7Schalte Nightvision an oder aus."); p.sendMessage(ChatColor.DARK_GRAY + "/" + ChatColor.YELLOW + "nightvision " + ChatColor.DARK_GRAY + "-" + ChatColor.GRAY + " Schalte Nightvision an oder aus.");
} }
@Register @Register
public void genericCommand(Player p) { public void genericCommand(Player p) {
if(p.hasPotionEffect(PotionEffectType.NIGHT_VISION)) { if(p.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
p.removePotionEffect(PotionEffectType.NIGHT_VISION); p.removePotionEffect(PotionEffectType.NIGHT_VISION);
SWUtils.sendToActionbar(p, "§eNightvision aus"); SWUtils.sendToActionbar(p, ChatColor.YELLOW + "Nightvision aus");
} else { } else {
p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 1000000, 255)); p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 1000000, 255));
SWUtils.sendToActionbar(p, "§eNightvision an"); SWUtils.sendToActionbar(p, ChatColor.YELLOW + "Nightvision an");
} }
} }
} }

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.inventory.meta.SkullMeta;
@ -37,7 +38,7 @@ public class SkullCommand extends SWCommand {
@Register(help = true) @Register(help = true)
public void genericHelp(Player p, String... args) { public void genericHelp(Player p, String... args) {
p.sendMessage("§8/§eskull §8[§eSpieler§8] §8- §7Gibt einen SpielerKopf"); p.sendMessage(ChatColor.DARK_GRAY + "/" + ChatColor.YELLOW + "skull " + ChatColor.DARK_GRAY + "[" + ChatColor.YELLOW + "Spieler" + ChatColor.DARK_GRAY + "] - " + ChatColor.GRAY + "Gibt einen SpielerKopf");
} }
@Register @Register
@ -45,7 +46,7 @@ public class SkullCommand extends SWCommand {
ItemStack is = SWItem.getPlayerSkull(skull).getItemStack(); ItemStack is = SWItem.getPlayerSkull(skull).getItemStack();
SkullMeta sm = (SkullMeta) is.getItemMeta(); SkullMeta sm = (SkullMeta) is.getItemMeta();
assert sm != null; assert sm != null;
sm.setDisplayName("§e" + skull + "§8s Kopf"); sm.setDisplayName(ChatColor.YELLOW + skull + ChatColor.DARK_GRAY + "s Kopf");
is.setItemMeta(sm); is.setItemMeta(sm);
SWUtils.giveItemToPlayer(p, is); SWUtils.giveItemToPlayer(p, is);
} }

Datei anzeigen

@ -23,6 +23,8 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import io.netty.channel.ChannelHandler;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@Linked(LinkageType.COMMAND) @Linked(LinkageType.COMMAND)
@ -34,21 +36,21 @@ public class SpeedCommand extends SWCommand {
@Register(help = true) @Register(help = true)
public void genericHelp(Player p, String[] args) { public void genericHelp(Player p, String[] args) {
p.sendMessage("§8/§espeed §8[§e1§8-§e10§8] §8- §7Setzte deine Flug- und Laufgeschindigkeit."); p.sendMessage(ChatColor.DARK_GRAY + "/" + ChatColor.YELLOW + "speed " + ChatColor.DARK_GRAY + "[" + ChatColor.YELLOW + "1" + ChatColor.DARK_GRAY + "-" + ChatColor.YELLOW + "10" + ChatColor.DARK_GRAY + "] - " + ChatColor.GRAY + "Setzte deine Flug- und Laufgeschindigkeit.");
p.sendMessage(BauSystem.PREFIX + "Aktuelle geschwindigkeit: §e" + p.getFlySpeed() * 10F); p.sendMessage(BauSystem.PREFIX + "Aktuelle geschwindigkeit: " + ChatColor.YELLOW + p.getFlySpeed() * 10F);
} }
@Register @Register
public void speedCommand(Player p, float speed) { public void speedCommand(Player p, float speed) {
speed = speed / 10F; speed = speed / 10F;
if (speed < -1F) { if (speed < -1F) {
p.sendMessage(BauSystem.PREFIX + "§c" + speed + " ist zu klein"); p.sendMessage(BauSystem.PREFIX + ChatColor.RED + speed + " ist zu klein");
} else if (speed > 1F) { } else if (speed > 1F) {
p.sendMessage(BauSystem.PREFIX + "§c" + speed + " ist zu hoch"); p.sendMessage(BauSystem.PREFIX + ChatColor.RED + speed + " ist zu hoch");
} else { } else {
p.setFlySpeed(speed); p.setFlySpeed(speed);
p.setWalkSpeed(speed); p.setWalkSpeed(speed);
p.sendMessage(BauSystem.PREFIX + "Aktuelle geschwindigkeit: §e" + p.getFlySpeed() * 10F); p.sendMessage(BauSystem.PREFIX + "Aktuelle geschwindigkeit: " + ChatColor.YELLOW + p.getFlySpeed() * 10F);
} }
} }
} }