Remove TNTSimulatorAnvil.java
Dieser Commit ist enthalten in:
Ursprung
cc929b88a7
Commit
6c030c1f9d
@ -22,6 +22,7 @@
|
|||||||
package de.steamwar.bausystem.cannonsimulator;
|
package de.steamwar.bausystem.cannonsimulator;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
|
import de.steamwar.inventory.SWAnvilInv;
|
||||||
import de.steamwar.inventory.SWInventory;
|
import de.steamwar.inventory.SWInventory;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.inventory.SWListInv;
|
import de.steamwar.inventory.SWListInv;
|
||||||
@ -116,7 +117,7 @@ public class TNTSimulator {
|
|||||||
|
|
||||||
// tnt Name
|
// tnt Name
|
||||||
swInventory.setItem(45, new SWItem(Material.NAME_TAG, "§eName", clickType -> {
|
swInventory.setItem(45, new SWItem(Material.NAME_TAG, "§eName", clickType -> {
|
||||||
TNTSimulatorAnvil tntSimulatorAnvil = new TNTSimulatorAnvil(player, "Name", "»" + tntSpawn.getName());
|
SWAnvilInv tntSimulatorAnvil = new SWAnvilInv(player, "Name", tntSpawn.getName());
|
||||||
tntSimulatorAnvil.setCallback(s -> {
|
tntSimulatorAnvil.setCallback(s -> {
|
||||||
if (s.startsWith("»")) s = s.substring(1);
|
if (s.startsWith("»")) s = s.substring(1);
|
||||||
tntSpawn.setName(s);
|
tntSpawn.setName(s);
|
||||||
@ -285,7 +286,7 @@ public class TNTSimulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void changeCount(Player player, int defaultValue, Consumer<Integer> result, Runnable failure) {
|
private static void changeCount(Player player, int defaultValue, Consumer<Integer> result, Runnable failure) {
|
||||||
TNTSimulatorAnvil swAnvilInv = new TNTSimulatorAnvil(player, "Zahl", defaultValue + "");
|
SWAnvilInv swAnvilInv = new SWAnvilInv(player, "Zahl", defaultValue + "");
|
||||||
swAnvilInv.setItem(Material.PAPER);
|
swAnvilInv.setItem(Material.PAPER);
|
||||||
swAnvilInv.setCallback(s -> {
|
swAnvilInv.setCallback(s -> {
|
||||||
try {
|
try {
|
||||||
@ -298,7 +299,7 @@ public class TNTSimulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void changePosition(Player player, double defaultValue, Consumer<Double> result, Runnable failure) {
|
private static void changePosition(Player player, double defaultValue, Consumer<Double> result, Runnable failure) {
|
||||||
TNTSimulatorAnvil swAnvilInv = new TNTSimulatorAnvil(player, "Position", defaultValue + "");
|
SWAnvilInv swAnvilInv = new SWAnvilInv(player, "Position", defaultValue + "");
|
||||||
swAnvilInv.setItem(Material.PAPER);
|
swAnvilInv.setItem(Material.PAPER);
|
||||||
swAnvilInv.setCallback(s -> {
|
swAnvilInv.setCallback(s -> {
|
||||||
try {
|
try {
|
||||||
|
@ -1,61 +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.cannonsimulator;
|
|
||||||
|
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
|
||||||
import net.wesjd.anvilgui.AnvilGUI;
|
|
||||||
import net.wesjd.anvilgui.AnvilGUI.Response;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class TNTSimulatorAnvil {
|
|
||||||
|
|
||||||
private final AnvilGUI.Builder builder;
|
|
||||||
private final Player player;
|
|
||||||
private Consumer<String> callback;
|
|
||||||
|
|
||||||
public TNTSimulatorAnvil(Player p, String t, String defaultValue) {
|
|
||||||
this.builder = (new AnvilGUI.Builder()).plugin(Core.getInstance()).title(t).text("" + defaultValue).onComplete(this::onResult);
|
|
||||||
this.player = p;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItem(Material m) {
|
|
||||||
this.builder.itemLeft((new SWItem(m, "").getItemStack()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCallback(Consumer<String> callback) {
|
|
||||||
this.callback = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void open() {
|
|
||||||
this.builder.open(this.player);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Response onResult(Player player, String s) {
|
|
||||||
this.callback.accept(s);
|
|
||||||
return Response.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
In neuem Issue referenzieren
Einen Benutzer sperren