MultiSchemTypes #403
@ -61,6 +61,8 @@ Schematic:
|
|||||||
z: 0
|
z: 0
|
||||||
# The schematic type that can be chosen in this arena
|
# The schematic type that can be chosen in this arena
|
||||||
Type: Normal # defaults to Normal if missing
|
Type: Normal # defaults to Normal if missing
|
||||||
|
# The schematic types that are also allowed to be chosen in this arena
|
||||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
|
|||||||
|
SubTypes: [] # defaults to empty List
|
||||||
# Shortcut of the schematic type
|
# Shortcut of the schematic type
|
||||||
Shortcut: "" # defaults to "" if missing
|
Shortcut: "" # defaults to "" if missing
|
||||||
# Spigot (1.8) material for GUIs
|
# Spigot (1.8) material for GUIs
|
||||||
|
@ -83,6 +83,7 @@ public class Config {
|
|||||||
public static final boolean OnlyPublicSchematics;
|
public static final boolean OnlyPublicSchematics;
|
||||||
public static final boolean IgnorePublicOnly;
|
public static final boolean IgnorePublicOnly;
|
||||||
public static final de.steamwar.sql.SchematicType SchematicType;
|
public static final de.steamwar.sql.SchematicType SchematicType;
|
||||||
|
public static final List<de.steamwar.sql.SchematicType> SubTypes;
|
||||||
public static final boolean RedRotate;
|
public static final boolean RedRotate;
|
||||||
public static final boolean BlueRotate;
|
public static final boolean BlueRotate;
|
||||||
public static final boolean PasteAligned;
|
public static final boolean PasteAligned;
|
||||||
@ -181,6 +182,7 @@ public class Config {
|
|||||||
int schemsizeZ = config.getInt("Schematic.Size.z");
|
int schemsizeZ = config.getInt("Schematic.Size.z");
|
||||||
Lixfel markierte diese Unterhaltung als gelöst
Veraltet
Lixfel
hat
Bitte nochmal überprüfen, ob fromDB erwartet, dass der Name in LowerCase ist, und wenn das der Fall ist, vorher bitte einmal .toLowerCase(). Bitte nochmal überprüfen, ob fromDB erwartet, dass der Name in LowerCase ist, und wenn das der Fall ist, vorher bitte einmal .toLowerCase().
YoyoNow
hat
Du machst es bei dem code da drüber auch nicht mit toLowercase, soll ich es einfach bei beiden dann einfügen? Ich glaube nämlich das es benötigt wird. Du machst es bei dem code da drüber auch nicht mit toLowercase, soll ich es einfach bei beiden dann einfügen? Ich glaube nämlich das es benötigt wird.
Lixfel
hat
Dann wird es nicht benötigt. Dann wird es nicht benötigt.
Lixfel
hat
Bitte das toLowerCase wieder rausnehmen (da unnötig) Bitte das toLowerCase wieder rausnehmen (da unnötig)
|
|||||||
RanksEnabled = !config.getStringList("Ranks").isEmpty();
|
RanksEnabled = !config.getStringList("Ranks").isEmpty();
|
||||||
SchematicType = de.steamwar.sql.SchematicType.fromDB(Objects.requireNonNull(config.getString("Schematic.Type", "normal")));
|
SchematicType = de.steamwar.sql.SchematicType.fromDB(Objects.requireNonNull(config.getString("Schematic.Type", "normal")));
|
||||||
|
SubTypes = config.getStringList("Schematic.SubTypes").stream().map(de.steamwar.sql.SchematicType::fromDB).collect(Collectors.toList());
|
||||||
IgnorePublicOnly = config.getBoolean("Schematic.IgnorePublicOnly", false);
|
IgnorePublicOnly = config.getBoolean("Schematic.IgnorePublicOnly", false);
|
||||||
boolean rotate = config.getBoolean("Schematic.Rotate", true);
|
boolean rotate = config.getBoolean("Schematic.Rotate", true);
|
||||||
PasteAligned = config.getBoolean("Schematic.PasteAligned", false);
|
PasteAligned = config.getBoolean("Schematic.PasteAligned", false);
|
||||||
|
@ -29,6 +29,7 @@ import de.steamwar.inventory.*;
|
|||||||
import de.steamwar.message.Message;
|
import de.steamwar.message.Message;
|
||||||
import de.steamwar.sql.PersonalKit;
|
import de.steamwar.sql.PersonalKit;
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
|
import de.steamwar.sql.SchematicType;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -167,36 +168,47 @@ public class GUI {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWInventory inv = new SWInventory(p, 9, msg.parse("SCHEM_TITLE", p, Config.GameName));
|
int invSize = (Config.SubTypes.size() + 1) * 9;
|
||||||
inv.setItem(8, Material.REDSTONE, msg.parse("SCHEM_PUBLIC", p, Config.GameName), (ClickType click) -> {
|
SWInventory inv = new SWInventory(p, invSize, msg.parse("SCHEM_TITLE", p, Config.GameName));
|
||||||
p.closeInventory();
|
setupSchemTypeRow(p, inv, Config.SchematicType, 0);
|
||||||
schemDialog(p, true, false);
|
for (int i = 0; i < Config.SubTypes.size(); i++) {
|
||||||
});
|
setupSchemTypeRow(p, inv, Config.SubTypes.get(i), i + 1);
|
||||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
Lixfel
hat
Immer .get(0)? Nicht get(i)? Immer .get(0)? Nicht get(i)?
YoyoNow
hat
Gut gesehen danke. Gut gesehen danke.
|
|||||||
if(Fight.getMaxRank() == 0){
|
|
||||||
inv.setItem(0, SWItem.getDye(8), (byte)8, msg.parse("SCHEM_PRIVATE_FORBIDDEN", p, Config.GameName), (ClickType click)->{});
|
|
||||||
}else {
|
|
||||||
if (Config.SchematicType.checkType() != null && !SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), Config.SchematicType.checkType().toDB()).isEmpty()) {
|
|
||||||
inv.setItem(4, Material.ANVIL, msg.parse("SCHEM_UNCHECKED", p, Config.GameName), (ClickType click) -> {
|
|
||||||
p.closeInventory();
|
|
||||||
schemDialog(p, false, true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if(SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), Config.SchematicType.toDB()).isEmpty() && !Config.test()){
|
|
||||||
inv.setItem(0, SWItem.getDye(8), (byte)8, msg.parse("SCHEM_NO_PRIVATE", p, Config.GameName), (ClickType click)->{});
|
|
||||||
}else{
|
|
||||||
inv.setItem(0, SWItem.getMaterial("CAULDRON_ITEM"), msg.parse("SCHEM_PRIVATE", p, Config.GameName), (ClickType click) -> {
|
|
||||||
p.closeInventory();
|
|
||||||
schemDialog(p, false, false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
||||||
inv.open();
|
inv.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void schemDialog(Player p, boolean publicSchems, boolean unchecked){
|
private static void setupSchemTypeRow(Player p, SWInventory inv, SchematicType type, int row) {
|
||||||
SchematicSelector selector = new SchematicSelector(p, Config.test()?SchematicSelector.selectSchematic():SchematicSelector.selectSchematicTypeWithRank(unchecked ? Config.SchematicType.checkType() : Config.SchematicType, Fight.getMaxRank()), node -> {
|
inv.setItem(row * 9 + 8, Material.REDSTONE, msg.parse("SCHEM_PUBLIC", p, type.name()), (ClickType click) -> {
|
||||||
|
p.closeInventory();
|
||||||
|
schemDialog(p, type, true, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (Fight.publicOnly()) {
|
||||||
|
inv.setItem(row * 9, SWItem.getDye(8), (byte)8, msg.parse("SCHEM_PRIVATE_FORBIDDEN", p, type.name()), (ClickType click)->{});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type.checkType() != null && type.checkType() != type && !SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), type.checkType().toDB()).isEmpty()) {
|
||||||
|
inv.setItem(row * 9 + 4, Material.ANVIL, msg.parse("SCHEM_UNCHECKED", p, type.name()), (ClickType click) -> {
|
||||||
|
p.closeInventory();
|
||||||
|
schemDialog(p, type, false, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), type.toDB()).isEmpty() && !Config.test()) {
|
||||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
Lixfel
hat
Hier nutzt du noch fälschlicherweise Config.SchematicType Hier nutzt du noch fälschlicherweise Config.SchematicType
|
|||||||
|
inv.setItem(row * 9, SWItem.getDye(8), (byte)8, msg.parse("SCHEM_NO_PRIVATE", p, type.name()), (ClickType click)->{});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
inv.setItem(row * 9, SWItem.getMaterial("CAULDRON_ITEM"), msg.parse("SCHEM_PRIVATE", p, type.name()), (ClickType click) -> {
|
||||||
|
p.closeInventory();
|
||||||
|
schemDialog(p, type, false, false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void schemDialog(Player p, SchematicType type, boolean publicSchems, boolean unchecked){
|
||||||
|
SchematicSelector selector = new SchematicSelector(p, Config.test() ? SchematicSelector.selectSchematic() : SchematicSelector.selectSchematicType(unchecked ? type.checkType() : type), node -> {
|
||||||
FightTeam fightTeam = Fight.getPlayerTeam(p);
|
FightTeam fightTeam = Fight.getPlayerTeam(p);
|
||||||
if(fightTeam == null)
|
if(fightTeam == null)
|
||||||
return;
|
return;
|
||||||
|
@ -139,21 +139,16 @@ public class Fight {
|
|||||||
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.GAMEMODE, new GameProfile(player.getUniqueId(), player.getName()), enable ? GameMode.CREATIVE : GameMode.SPECTATOR));
|
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.GAMEMODE, new GameProfile(player.getUniqueId(), player.getName()), enable ? GameMode.CREATIVE : GameMode.SPECTATOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getMaxRank(){
|
public static boolean publicOnly() {
|
||||||
/* MaxRank of 0 is Pubonly*/
|
|
||||||
if (Config.OnlyPublicSchematics) {
|
if (Config.OnlyPublicSchematics) {
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.IgnorePublicOnly || ArenaMode.RankedEvent.contains(Config.mode)) {
|
if (Config.IgnorePublicOnly || ArenaMode.RankedEvent.contains(Config.mode)) {
|
||||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
Lixfel
hat
Hier fehlt wie früher die Prüfung, ob es ein Event ist (wobei dann ebenfalls IgnorePublicOnly gilt). Wenn es ein Public-Only Turnier ist, wird das bereits über OnlyPublicSchematics separat geregelt. Hier fehlt wie früher die Prüfung, ob es ein Event ist (wobei dann ebenfalls IgnorePublicOnly gilt). Wenn es ein Public-Only Turnier ist, wird das bereits über OnlyPublicSchematics separat geregelt.
|
|||||||
return 1000;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (redTeam.getLeader() == null || blueTeam.getLeader() == null) {
|
if (redTeam.getLeader() == null || blueTeam.getLeader() == null) {
|
||||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
Lixfel
hat
Ich weiß nicht, ob wir diesen Überprüfungscode einfach so rauswerfen sollten (publicOnly, solange noch einer der Gegner fehlt). Ich weiß nicht, ob wir diesen Überprüfungscode einfach so rauswerfen sollten (publicOnly, solange noch einer der Gegner fehlt).
|
|||||||
return 1000;
|
return false;
|
||||||
}
|
}
|
||||||
|
return redTeam.isPublicsOnly() || blueTeam.isPublicsOnly();
|
||||||
return Math.min(redTeam.getSchemRank(), blueTeam.getSchemRank());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ public class FightTeam {
|
|||||||
|
|
||||||
private UUID designatedLeader;
|
private UUID designatedLeader;
|
||||||
private FightPlayer leader;
|
private FightPlayer leader;
|
||||||
private int schemRank;
|
private boolean publicsOnly;
|
||||||
|
|
||||||
private final Map<UUID, FightPlayer> players = new HashMap<>();
|
private final Map<UUID, FightPlayer> players = new HashMap<>();
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ public class FightTeam {
|
|||||||
this.spawn = spawn;
|
this.spawn = spawn;
|
||||||
this.schemRegion = schemRegion;
|
this.schemRegion = schemRegion;
|
||||||
this.extendRegion = extendRegion;
|
this.extendRegion = extendRegion;
|
||||||
this.schemRank = 0;
|
this.publicsOnly = false;
|
||||||
this.ready = false;
|
this.ready = false;
|
||||||
this.skip = false;
|
this.skip = false;
|
||||||
this.blue = blue;
|
this.blue = blue;
|
||||||
@ -161,8 +161,8 @@ public class FightTeam {
|
|||||||
return isLeaderless() && (designatedLeader == null || designatedLeader.equals(p.getUniqueId()));
|
return isLeaderless() && (designatedLeader == null || designatedLeader.equals(p.getUniqueId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSchemRank() {
|
public boolean isPublicsOnly() {
|
||||||
return schemRank;
|
return publicsOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void teleportToSpawn(){
|
public void teleportToSpawn(){
|
||||||
@ -357,11 +357,7 @@ public class FightTeam {
|
|||||||
if(!silent)
|
if(!silent)
|
||||||
FightUI.addSubtitle("UI_LEADER_JOINS", prefix, leader.getEntity().getName());
|
FightUI.addSubtitle("UI_LEADER_JOINS", prefix, leader.getEntity().getName());
|
||||||
|
|
||||||
Optional<Integer> maxRank = SchematicNode.getAllAccessibleSchematicsOfType(leader.getUser().getId(), Config.SchematicType.toDB()).stream().map(SchematicNode::getRank).max(Integer::compare);
|
publicsOnly = SchematicNode.getAllAccessibleSchematicsOfType(leader.getUser().getId(), Config.SchematicType.toDB()).isEmpty();
|
||||||
if(Config.RanksEnabled)
|
|
||||||
schemRank = maxRank.orElse(1);
|
|
||||||
else
|
|
||||||
schemRank = maxRank.isPresent() ? 1 : 0;
|
|
||||||
|
|
||||||
if(!Config.PersonalKits)
|
if(!Config.PersonalKits)
|
||||||
leader.setKit(Kit.getKitByName(Config.LeaderDefault));
|
leader.setKit(Kit.getKitByName(Config.LeaderDefault));
|
||||||
|
Bitte wie bei den anderen Optionen in einen Kommentar in der Zeile darüber noch erklären, was diese Option bedeutet.