CannonSimulator #164
@ -22,6 +22,7 @@
|
||||
package de.steamwar.bausystem.cannonsimulator;
|
||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.inventory.SWAnvilInv;
|
||||
import de.steamwar.inventory.SWInventory;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.inventory.SWListInv;
|
||||
@ -116,7 +117,7 @@ public class TNTSimulator {
|
||||
|
||||
// tnt Name
|
||||
swInventory.setItem(45, new SWItem(Material.NAME_TAG, "§eName", clickType -> {
|
||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
Chaoscaot
hat
Warum brauchen die Tnts einen Namen? Diese Simulationen sind nicht abspeicherbar, deshalb sehe ich den Sinn in einem Namen für das TNT nicht. Warum brauchen die Tnts einen Namen? Diese Simulationen sind nicht abspeicherbar, deshalb sehe ich den Sinn in einem Namen für das TNT nicht.
YoyoNow
hat
Ist aber trotzdem wichtig, damit man in einer Simulation einfach die TNT auseinanderhalten kann Ist aber trotzdem wichtig, damit man in einer Simulation einfach die TNT auseinanderhalten kann
|
||||
TNTSimulatorAnvil tntSimulatorAnvil = new TNTSimulatorAnvil(player, "Name", "»" + tntSpawn.getName());
|
||||
SWAnvilInv tntSimulatorAnvil = new SWAnvilInv(player, "Name", tntSpawn.getName());
|
||||
tntSimulatorAnvil.setCallback(s -> {
|
||||
if (s.startsWith("»")) s = s.substring(1);
|
||||
tntSpawn.setName(s);
|
||||
@ -285,7 +286,7 @@ public class TNTSimulator {
|
||||
}
|
||||
|
||||
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 + "");
|
||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
Chaoscaot
hat
Zahl? ZAHL! evt. Mal etwas beschreiben deren Titel nehmen Zahl? ZAHL! evt. Mal etwas beschreiben deren Titel nehmen
|
||||
swAnvilInv.setItem(Material.PAPER);
|
||||
swAnvilInv.setCallback(s -> {
|
||||
try {
|
||||
@ -298,7 +299,7 @@ public class TNTSimulator {
|
||||
}
|
||||
|
||||
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.setCallback(s -> {
|
||||
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
Warum braucht das sein eigenes Package? Und kann nicht einfach in das
world
package rein?