RedstoneTester #202
@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.PlayerUtils;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -28,6 +28,6 @@ class CommandDebugStick_15 {
|
||||
private CommandDebugStick_15(){}
|
||||
|
||||
static void giveStick(Player player){
|
||||
PlayerUtils.giveItemToPlayer(player, new ItemStack(Material.DEBUG_STICK));
|
||||
SWUtils.giveItemToPlayer(player, new ItemStack(Material.DEBUG_STICK));
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,9 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class PlayerUtils {
|
||||
import java.util.List;
|
||||
|
||||
public class SWUtils {
|
||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
|
||||
|
||||
public static void giveItemToPlayer(Player player, ItemStack itemStack) {
|
||||
ItemStack current = player.getInventory().getItemInMainHand();
|
||||
@ -33,4 +35,18 @@ public class PlayerUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> manageList(List<String> strings, String[] args, int index) {
|
||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
Chaoscaot
hat
Die Die `SWUtils` in einen eigenen PR
|
||||
for (int i = strings.size() - 1; i >= 0; i--) {
|
||||
if (!strings.get(i).startsWith(args[index])) {
|
||||
strings.remove(i);
|
||||
}
|
||||
}
|
||||
return strings;
|
||||
}
|
||||
|
||||
public static List<String> manageList(List<String> strings, String[] args) {
|
||||
return manageList(strings, args, args.length - 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TabCompleteUtils {
|
||||
|
||||
public static List<String> manageList(List<String> strings, String[] args, int index) {
|
||||
for (int i = strings.size() - 1; i >= 0; i--) {
|
||||
if (!strings.get(i).startsWith(args[index])) {
|
||||
strings.remove(i);
|
||||
}
|
||||
}
|
||||
return strings;
|
||||
}
|
||||
|
||||
}
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.PlayerUtils;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.world.Detonator;
|
||||
import de.steamwar.bausystem.world.Welt;
|
||||
import org.bukkit.command.Command;
|
||||
@ -63,7 +63,7 @@ public class CommandDetonator implements CommandExecutor {
|
||||
case "wand":
|
||||
case "detonator":
|
||||
case "item":
|
||||
PlayerUtils.giveItemToPlayer(player, Detonator.WAND);
|
||||
SWUtils.giveItemToPlayer(player, Detonator.WAND);
|
||||
player.updateInventory();
|
||||
break;
|
||||
case "remove":
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
@ -45,15 +46,6 @@ public class CommandDetonatorTabCompleter implements TabCompleter {
|
||||
if (args.length >= 2) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return manageList(tabComplete, args, 0);
|
||||
}
|
||||
|
||||
private List<String> manageList(List<String> strings, String[] args, int index) {
|
||||
for (int i = strings.size() - 1; i >= 0; i--) {
|
||||
if (!strings.get(i).startsWith(args[index])) {
|
||||
strings.remove(i);
|
||||
}
|
||||
}
|
||||
return strings;
|
||||
return SWUtils.manageList(tabComplete, args, 0);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.PlayerUtils;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
|
||||
import de.steamwar.bausystem.tracer.show.TraceShowManager;
|
||||
import de.steamwar.bausystem.world.*;
|
||||
@ -591,7 +591,7 @@ public class CommandGUI implements CommandExecutor, Listener {
|
||||
openBauGui(player);
|
||||
OPEN_INVS.add(player);
|
||||
} else if ("item".equalsIgnoreCase(strings[0])) {
|
||||
PlayerUtils.giveItemToPlayer(player, new ItemStack(Material.NETHER_STAR));
|
||||
SWUtils.giveItemToPlayer(player, new ItemStack(Material.NETHER_STAR));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -19,8 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.PlayerUtils;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.world.RedstoneListener;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -49,7 +48,7 @@ public class CommandRedstoneTester implements CommandExecutor {
|
||||
help(player);
|
||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
Chaoscaot
hat
Hier kann man auch noch die VersionedCallable nehmen. :D Hier kann man auch noch die VersionedCallable nehmen. :D
|
||||
break;
|
||||
case "wand":
|
||||
PlayerUtils.giveItemToPlayer(player, RedstoneListener.WAND);
|
||||
SWUtils.giveItemToPlayer(player, RedstoneListener.WAND);
|
||||
break;
|
||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
Chaoscaot
hat
Hier noch der SW-Prefix Hier noch der SW-Prefix
|
||||
}
|
||||
return false;
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.TabCompleteUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.PlayerUtils;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -68,7 +68,7 @@ public class CommandScript implements CommandExecutor {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
PlayerUtils.giveItemToPlayer((Player) sender, BOOK);
|
||||
SWUtils.giveItemToPlayer((Player) sender, BOOK);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.PlayerUtils;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.world.TNTSimulator;
|
||||
import de.steamwar.bausystem.world.Welt;
|
||||
import org.bukkit.command.Command;
|
||||
@ -59,7 +59,7 @@ public class CommandSimulator implements CommandExecutor {
|
||||
if (args.length == 1) {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "wand":
|
||||
PlayerUtils.giveItemToPlayer(player, TNTSimulator.WAND);
|
||||
SWUtils.giveItemToPlayer(player, TNTSimulator.WAND);
|
||||
break;
|
||||
case "start":
|
||||
TNTSimulator.get(player).start();
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.TabCompleteUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
|
@ -20,7 +20,7 @@
|
||||
package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.PlayerUtils;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -47,7 +47,7 @@ public class CommandSkull implements CommandExecutor {
|
||||
assert sm != null;
|
||||
sm.setDisplayName("§e" + args[0] + "§8s Kopf");
|
||||
is.setItemMeta(sm);
|
||||
PlayerUtils.giveItemToPlayer(p, is);
|
||||
SWUtils.giveItemToPlayer(p, is);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.TabCompleteUtils;
|
||||
import de.steamwar.bausystem.world.Region;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
|
||||
import de.steamwar.bausystem.tracer.record.RecordStatus;
|
||||
import org.bukkit.command.Command;
|
||||
@ -54,14 +55,7 @@ public class CommandTraceTabCompleter implements TabCompleter {
|
||||
for (TabComplete tab : tabCompletes) {
|
||||
if (tab.test(player, args)) tabComplete.addAll(Arrays.asList(tab.getTabCompletes()));
|
||||
}
|
||||
return manageList(tabComplete, args);
|
||||
}
|
||||
|
||||
private List<String> manageList(List<String> strings, String[] args) {
|
||||
for (int i = strings.size() - 1; i >= 0; i--) {
|
||||
if (!strings.get(i).startsWith(args[args.length - 1])) strings.remove(i);
|
||||
}
|
||||
return strings;
|
||||
return SWUtils.manageList(tabComplete, args);
|
||||
}
|
||||
|
||||
private static class TabComplete {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Kann man das nicht in einen eigenen PR machen?
Ich würde dies nicht machen, weil das nur unnütz neue PR's macht und ich ja genau hier die Verbesserung dadurch mache.
Mach es für die Prüfbarkeit in einen eigenen PR, man sollte nicht zwei große änderungen bzw. eine Änderung und ein Refactor in einem PR machen