Compare commits
27 Commits
20d9e14cc4
...
3c674c23fc
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c674c23fc | |||
| e1633d7c47 | |||
| d635c3a456 | |||
| c38777158a | |||
| 2bc295c620 | |||
| 88cc06560e | |||
| 566a7deee3 | |||
| ea07766460 | |||
| 9c5b7712cb | |||
| 84b14b8c3d | |||
| abeb269368 | |||
| fc002abf37 | |||
| 09f9a8ce32 | |||
| d0d353b24d | |||
| 52828c8b4e | |||
| 01efb9fce5 | |||
| 8b636a11ee | |||
| 8ca1cf9b5c | |||
| ad4304d7b0 | |||
| e5e931d331 | |||
| ed87197681 | |||
| e6e475e4bb | |||
| daa69dc22b | |||
| d011ffa536 | |||
| 4798b16015 | |||
| f4c9ce512e | |||
| bfe9c7559e |
@@ -137,7 +137,9 @@ BAU_INFO_ITEM_LORE_FIRE=§7Fire§8: §e{0}
|
||||
BAU_INFO_ITEM_LORE_COLOR=§7Color§8: §e{0}
|
||||
BAU_INFO_ITEM_LORE_PROTECT=§7Protect§8: §e{0}
|
||||
BAU_INFO_ITEM_LORE_ITEMS=§7Items§8: §e{0}
|
||||
BAU_INFO_ITEM_LORE_NO_GRAVITY = §8NoGravity§8: §e{0}
|
||||
BAU_INFO_ITEM_LORE_NO_GRAVITY = §7NoGravity§8: §e{0}
|
||||
BAU_INFO_ITEM_LORE_TESTBLOCK=§7Testblock§8: §e{0}
|
||||
BAU_INFO_ITEM_LORE_CHANGED=§7Changed§8: §e{0}
|
||||
BAU_INFO_COMMAND_HELP=§8/§ebauinfo §8- §7Information regarding this build server
|
||||
BAU_INFO_COMMAND_OWNER=§7Owner§8: §e{0}
|
||||
BAU_INFO_COMMAND_MEMBER=§7{0} §8[§7{1}§8]§8: §e{2}
|
||||
|
||||
@@ -119,12 +119,9 @@ BACKUP_LORE=§eKlicken zum Laden
|
||||
BAU_COMMAND_HELP_INFO=§8/§ebau info §8- §7Alias für §8/§ebauinfo
|
||||
BAU_INFO_ITEM_NAME=§eBau-Management
|
||||
## This is used in BauInfoBauGuiItem.java
|
||||
BAU_INFO_ITEM_LORE_TNT=§7TNT§8: §e{0}
|
||||
BAU_INFO_ITEM_LORE_FREEZE=§7Freeze§8: §e{0}
|
||||
BAU_INFO_ITEM_LORE_DAMAGE=§7Damage§8: §e{0}
|
||||
BAU_INFO_ITEM_LORE_FIRE=§7Feuer§8: §e{0}
|
||||
BAU_INFO_ITEM_LORE_COLOR=§7Farbe§8: §e{0}
|
||||
BAU_INFO_ITEM_LORE_PROTECT=§7Protect§8: §e{0}
|
||||
BAU_INFO_ITEM_LORE_CHANGED=§7Verändert§8: §e{0}
|
||||
BAU_INFO_COMMAND_HELP=§8/§ebauinfo §8- §7Gibt Informationen über den Bau
|
||||
BAU_INFO_COMMAND_OWNER=§7Besitzer§8: §e{0}
|
||||
BAU_INFO_COMMAND_MEMBER=§7{0} §8[§7{1}§8]§8: §e{2}
|
||||
|
||||
@@ -38,41 +38,29 @@ import de.steamwar.bausystem.utils.TickListener;
|
||||
import de.steamwar.bausystem.utils.TickManager;
|
||||
import de.steamwar.bausystem.worlddata.WorldData;
|
||||
import de.steamwar.command.AbstractValidator;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.SWCommandUtils;
|
||||
import de.steamwar.core.CRIUSleepEvent;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.core.WorldEditRendererCUIEditor;
|
||||
import de.steamwar.linkage.LinkedInstance;
|
||||
import de.steamwar.linkage.MaxVersion;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
import de.steamwar.linkage.PluginCheck;
|
||||
import de.steamwar.linkage.api.Disable;
|
||||
import de.steamwar.linkage.api.Enable;
|
||||
import de.steamwar.linkage.AbstractLinker;
|
||||
import de.steamwar.linkage.SpigotLinker;
|
||||
import de.steamwar.message.Message;
|
||||
import de.steamwar.network.packets.PacketHandler;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class BauSystem extends JavaPlugin implements Listener {
|
||||
|
||||
@@ -83,7 +71,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
@Getter
|
||||
private static BauSystem instance;
|
||||
|
||||
private final Map<Class<?>, Object> instances = new HashMap<>();
|
||||
private SpigotLinker linker;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
@@ -96,115 +84,43 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
SWUtils.setBausystem(instance);
|
||||
|
||||
RegionSystem.INSTANCE.load();
|
||||
/*
|
||||
try {
|
||||
PrototypeLoader.load();
|
||||
RegionLoader.load();
|
||||
} catch (SecurityException e) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e);
|
||||
Bukkit.shutdown();
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
new Updater(PrototypeLoader.file, PrototypeLoader::load);
|
||||
new Updater(RegionLoader.file, RegionLoader::load);
|
||||
*/
|
||||
|
||||
SWCommandUtils.addValidator(Player.class, validator(Permission.BUILD));
|
||||
SWCommandUtils.addValidator(CommandSender.class, validator(Permission.BUILD));
|
||||
SWCommandUtils.addValidator("supervisor", validator(Permission.SUPERVISOR));
|
||||
SWCommandUtils.addValidator("owner", validator(Permission.OWNER));
|
||||
|
||||
instances.put(BauServer.class, BauServer.getInstance());
|
||||
List<Class<?>> classes = new BufferedReader(new InputStreamReader(BauSystem.class.getResourceAsStream("/META-INF/annotations/de.steamwar.linkage.Linked")))
|
||||
.lines()
|
||||
.map(s -> {
|
||||
try {
|
||||
return Class.forName(s, false, BauSystem.class.getClassLoader());
|
||||
} catch (ClassNotFoundException | NoClassDefFoundError e) {
|
||||
if (e.getMessage().equals(s)) {
|
||||
Bukkit.shutdown();
|
||||
throw new SecurityException(e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
classes.forEach(clazz -> {
|
||||
MinVersion minVersion = clazz.getAnnotation(MinVersion.class);
|
||||
MaxVersion maxVersion = clazz.getAnnotation(MaxVersion.class);
|
||||
PluginCheck[] pluginChecks = clazz.getAnnotationsByType(PluginCheck.class);
|
||||
if (minVersion != null && Core.getVersion() < minVersion.value()) {
|
||||
return;
|
||||
}
|
||||
if (maxVersion != null && Core.getVersion() > maxVersion.value()) {
|
||||
return;
|
||||
}
|
||||
for (PluginCheck pluginCheck : pluginChecks) {
|
||||
if (pluginCheck.has() == PluginCheck.Has.THIS && Bukkit.getPluginManager().getPlugin(pluginCheck.value()) != null) {
|
||||
continue;
|
||||
linker = new SpigotLinker(BauSystem.getInstance(), BauSystem.MESSAGE) {
|
||||
@Override
|
||||
protected void linkObject(Object any) {
|
||||
super.linkObject(any);
|
||||
if (any instanceof LuaLib) {
|
||||
SteamWarLuaPlugin.add((LuaLib) any);
|
||||
}
|
||||
if (pluginCheck.has() == PluginCheck.Has.NOT && Bukkit.getPluginManager().getPlugin(pluginCheck.value()) == null) {
|
||||
continue;
|
||||
if (any instanceof ScoreboardElement) {
|
||||
BauScoreboard.addElement((ScoreboardElement) any);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Object any;
|
||||
try {
|
||||
any = clazz.newInstance();
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
getLogger().log(Level.SEVERE, e.getMessage(), e);
|
||||
Bukkit.shutdown();
|
||||
throw new SecurityException(e.getMessage());
|
||||
}
|
||||
|
||||
instances.put(clazz, any);
|
||||
if (any instanceof Enable) {
|
||||
((Enable) any).enable();
|
||||
}
|
||||
if (any instanceof SWCommand) {
|
||||
((SWCommand) any).setMessage(BauSystem.MESSAGE);
|
||||
}
|
||||
if (any instanceof Listener) {
|
||||
Bukkit.getPluginManager().registerEvents((Listener) any, BauSystem.getInstance());
|
||||
}
|
||||
if (any instanceof PacketHandler) {
|
||||
((PacketHandler) any).register();
|
||||
}
|
||||
if (any instanceof LuaLib) {
|
||||
SteamWarLuaPlugin.add((LuaLib) any);
|
||||
}
|
||||
if (any instanceof ScoreboardElement) {
|
||||
BauScoreboard.addElement((ScoreboardElement) any);
|
||||
}
|
||||
if (any instanceof BauGuiItem) {
|
||||
BauGUI.addItem((BauGuiItem) any);
|
||||
}
|
||||
if (any instanceof PanzernAlgorithm) {
|
||||
Panzern.add((PanzernAlgorithm) any);
|
||||
}
|
||||
if (any instanceof ConfigConverter) {
|
||||
Config.addConfigConverter((ConfigConverter) any);
|
||||
}
|
||||
if (any instanceof BoundingBoxLoader) {
|
||||
((BoundingBoxLoader) any).load();
|
||||
}
|
||||
});
|
||||
|
||||
instances.forEach((clazz, o) -> {
|
||||
for (Field field : clazz.getFields()) {
|
||||
if (field.getAnnotation(LinkedInstance.class) != null) {
|
||||
try {
|
||||
field.set(o, instances.get(field.getType()));
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (any instanceof BauGuiItem) {
|
||||
BauGUI.addItem((BauGuiItem) any);
|
||||
}
|
||||
if (any instanceof PanzernAlgorithm) {
|
||||
Panzern.add((PanzernAlgorithm) any);
|
||||
}
|
||||
if (any instanceof ConfigConverter) {
|
||||
Config.addConfigConverter((ConfigConverter) any);
|
||||
}
|
||||
if (any instanceof BoundingBoxLoader) {
|
||||
((BoundingBoxLoader) any).load();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
try {
|
||||
linker.addLinkableInstance(BauServer.getInstance());
|
||||
linker.link();
|
||||
} catch (AbstractLinker.LinkException e) {
|
||||
getLogger().log(Level.SEVERE, "Could not link a class.", e);
|
||||
Bukkit.shutdown();
|
||||
}
|
||||
|
||||
TickListener.impl.init();
|
||||
|
||||
@@ -221,15 +137,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
instances.forEach((aClass, o) -> {
|
||||
if (o instanceof Listener) {
|
||||
HandlerList.unregisterAll((Listener) o);
|
||||
}
|
||||
if (o instanceof Disable) {
|
||||
((Disable) o).disable();
|
||||
}
|
||||
});
|
||||
|
||||
linker.unlink();
|
||||
WorldData.write();
|
||||
RegionSystem.INSTANCE.save();
|
||||
Config.getInstance().saveAll();
|
||||
|
||||
@@ -110,14 +110,14 @@ public class BackupCommand extends SWCommand {
|
||||
}
|
||||
SWListInv<RegionBackups.Backup> swListInv = new SWListInv<>(p, BauSystem.MESSAGE.parse("BACKUP_INV_NAME", p), swListEntries, (clickType, s) -> {
|
||||
p.getOpenInventory().close();
|
||||
p.performCommand("backup load " + s);
|
||||
backupLoad(p, s);
|
||||
});
|
||||
swListInv.open();
|
||||
}
|
||||
|
||||
@Mapper(value = "backup", local = true)
|
||||
public TypeMapper<RegionBackups.Backup> backupMapper() {
|
||||
return new TypeMapper<RegionBackups.Backup>() {
|
||||
return new TypeMapper<>() {
|
||||
@Override
|
||||
public RegionBackups.Backup map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
return Region.getRegion(((Player) commandSender).getLocation()).getBackups().get(s);
|
||||
|
||||
@@ -26,7 +26,6 @@ import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||
import de.steamwar.bausystem.region.FlagOptional;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
|
||||
@@ -23,7 +23,6 @@ import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
|
||||
@@ -30,6 +30,7 @@ import de.steamwar.entity.REntityServer;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -38,15 +39,15 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.util.RayTraceResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Linked
|
||||
@MinVersion(20)
|
||||
public class RayVisualizerCommand extends SWCommand implements Listener {
|
||||
|
||||
private BlockData VISIBLE = Material.LIME_CONCRETE.createBlockData();
|
||||
private BlockData BLOCKED = Material.RED_CONCRETE.createBlockData();
|
||||
|
||||
private class CRayData {
|
||||
private CRay[] rays = new CRay[27 * 400];
|
||||
private boolean[] used = new boolean[27 * 400];
|
||||
@@ -108,28 +109,23 @@ public class RayVisualizerCommand extends SWCommand implements Listener {
|
||||
|
||||
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> {
|
||||
if (server.getPlayers().isEmpty()) return;
|
||||
Map<Integer, List<TNTPrimed>> primedList = WORLD.getEntitiesByClass(TNTPrimed.class)
|
||||
.stream()
|
||||
.collect(Collectors.groupingBy(TNTPrimed::getFuseTicks));
|
||||
List<TNTPrimed> primedList = WORLD.getEntitiesByClass(TNTPrimed.class)
|
||||
.stream().toList();
|
||||
rayData.reset();
|
||||
if (primedList.isEmpty()) return;
|
||||
|
||||
List<Integer> fuseTicks = primedList.keySet().stream().sorted().collect(Collectors.toList());
|
||||
List<TNTPrimed> current = new ArrayList<>();
|
||||
for (int i = 0; i < fuseTicks.size(); i++) {
|
||||
List<TNTPrimed> tnts = primedList.get(fuseTicks.get(i));
|
||||
calculateRays(current, tnts);
|
||||
current.addAll(tnts);
|
||||
}
|
||||
calculateRays(primedList, primedList);
|
||||
}, 1, 1);
|
||||
}
|
||||
|
||||
private void calculateRays(List<TNTPrimed> fromTNTs, List<TNTPrimed> toTNTs) {
|
||||
for (TNTPrimed from : fromTNTs) {
|
||||
if (!from.isInWater()) continue;
|
||||
for (TNTPrimed to : toTNTs) {
|
||||
for (TNTPrimed to : toTNTs) {
|
||||
int hitting = 0;
|
||||
int total = 0;
|
||||
for (TNTPrimed from : fromTNTs) {
|
||||
if (from == to) continue;
|
||||
if (from.getFuseTicks() >= to.getFuseTicks()) continue;
|
||||
if (to.getLocation().distanceSquared(from.getLocation()) > 25) continue;
|
||||
if (!from.isInWater()) continue;
|
||||
|
||||
Location fromLoc = from.getLocation();
|
||||
Location toLoc = to.getLocation().clone().add(-0.49, 0, -0.49);
|
||||
@@ -143,16 +139,29 @@ public class RayVisualizerCommand extends SWCommand implements Listener {
|
||||
for (int dz = 0; dz < 3; dz++) {
|
||||
Location end = toLoc.clone().add(minX + dx * spacing, 0 + dy * spacing, minZ + dz * spacing);
|
||||
RayTraceResult result = fromLoc.getWorld().rayTraceBlocks(fromLoc, end.clone().subtract(fromLoc).toVector(), end.distance(fromLoc), FluidCollisionMode.NEVER, true);
|
||||
if (result != null && result.getHitBlock() != null) {
|
||||
continue;
|
||||
}
|
||||
CRay cRay = rayData.get(fromLoc, end);
|
||||
if (cRay == null) continue;
|
||||
cRay.setFrom(fromLoc);
|
||||
cRay.setTo(end);
|
||||
if (result != null && result.getHitBlock() != null) {
|
||||
cRay.setBlock(BLOCKED);
|
||||
} else {
|
||||
cRay.setBlock(VISIBLE);
|
||||
hitting++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
total += 27;
|
||||
}
|
||||
|
||||
if (total == 0) {
|
||||
to.setCustomNameVisible(false);
|
||||
} else {
|
||||
int remainder = hitting % 27;
|
||||
int whole = hitting / 27;
|
||||
to.setCustomNameVisible(true);
|
||||
to.setCustomName("§e" + whole + " " + remainder + "/27");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,6 @@ import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.flags.ColorMode;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
|
||||
@@ -103,7 +103,7 @@ public class RegionCommand extends SWCommand {
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getArea().getResetFile()))
|
||||
.ignoreAir(true)
|
||||
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
|
||||
region.getArea().reset(pasteBuilder, true);
|
||||
region.getArea().reset(pasteBuilder, false);
|
||||
RegionUtils.message(region, "REGION_REGION_RESTORED");
|
||||
} catch (SecurityException e) {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_FAILED_RESTORE", p);
|
||||
@@ -125,7 +125,7 @@ public class RegionCommand extends SWCommand {
|
||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.SchematicProvider(node))
|
||||
.ignoreAir(true)
|
||||
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
|
||||
region.getArea().reset(pasteBuilder, true);
|
||||
region.getArea().reset(pasteBuilder, false);
|
||||
RegionUtils.message(region, "REGION_REGION_RESTORED");
|
||||
} catch (SecurityException e) {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_FAILED_RESTORE", p);
|
||||
|
||||
@@ -181,13 +181,7 @@ public class RegionListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void tagChangedRegion(final Location location) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Region.getRegion(location).getFlags().set(Flag.CHANGED, ChangedMode.HAS_CHANGE);
|
||||
}
|
||||
}.runTaskAsynchronously(BauSystem.getInstance());
|
||||
Region.getRegion(location).getFlags().set(Flag.CHANGED, ChangedMode.HAS_CHANGE);
|
||||
}
|
||||
}
|
||||
@@ -23,12 +23,9 @@ import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Linked
|
||||
public class RegionScoreboardElement implements ScoreboardElement {
|
||||
|
||||
@@ -25,7 +25,6 @@ import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
|
||||
@@ -25,8 +25,6 @@ import de.steamwar.bausystem.features.script.ScriptRunner;
|
||||
import de.steamwar.bausystem.features.script.lua.SteamWarGlobalLuaPlugin;
|
||||
import de.steamwar.bausystem.features.script.lua.libs.StorageLib;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.luaj.vm2.LuaTable;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
import org.luaj.vm2.lib.OneArgFunction;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -46,11 +47,15 @@ public class RegionLib implements LuaLib {
|
||||
table.set("name", getter(() -> region.get().getID().toString()));
|
||||
table.set("id", getter(() -> region.get().getID().toString()));
|
||||
table.set("type", getter(() -> {
|
||||
Region region1 = region.get();
|
||||
if (region1.getType().isGlobal()) {
|
||||
Region rg = region.get();
|
||||
if (rg.getType().isGlobal()) {
|
||||
return "global";
|
||||
}
|
||||
return region1.getType().name().toLowerCase();
|
||||
List<String> chatNames = rg.getGameModeConfig().getServer().getChatNames();
|
||||
if (chatNames.isEmpty()) {
|
||||
return "unknown";
|
||||
}
|
||||
return chatNames.get(0).toLowerCase();
|
||||
}));
|
||||
|
||||
LuaValue tntLib = LuaValue.tableOf();
|
||||
|
||||
@@ -23,6 +23,7 @@ import de.steamwar.bausystem.features.simulator.data.SimulatorPhase;
|
||||
import de.steamwar.bausystem.features.simulator.execute.SimulatorAction;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.FreezeMode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@@ -64,7 +65,7 @@ public final class TNTPhase extends SimulatorPhase {
|
||||
@Override
|
||||
public void accept(World world) {
|
||||
Location location = position.toLocation(world);
|
||||
if (Region.getRegion(location).getFlags().get(Flag.FREEZE).isPresent()) return;
|
||||
if (Region.getRegion(location).getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) return;
|
||||
TNTPrimed tnt = world.spawn(location, TNTPrimed.class);
|
||||
if (!xJump) tnt.setVelocity(tnt.getVelocity().setX(0));
|
||||
if (!yJump) tnt.setVelocity(tnt.getVelocity().setY(0));
|
||||
|
||||
@@ -34,16 +34,12 @@ import de.steamwar.linkage.LinkedInstance;
|
||||
import de.steamwar.techhider.TechHider;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@@ -31,9 +31,19 @@ public class TraceRepository {
|
||||
public static Trace readTrace(File recordsFile) {
|
||||
@Cleanup
|
||||
ObjectInputStream reader = new ObjectInputStream(new GZIPInputStream(new FileInputStream(recordsFile)));
|
||||
UUID uuid = UUID.fromString(reader.readUTF());
|
||||
Region region = RegionSystem.INSTANCE.getRegion(UUID.fromString(reader.readUTF())).orElse(null);
|
||||
if (region == null) return null;
|
||||
UUID uuid;
|
||||
try {
|
||||
uuid = UUID.fromString(reader.readUTF());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
Region region;
|
||||
try {
|
||||
region = RegionSystem.INSTANCE.getRegion(UUID.fromString(reader.readUTF())).orElse(null);
|
||||
if (region == null) return null;
|
||||
} catch (IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
Date date = (Date) reader.readObject();
|
||||
int serialisationVersion = reader.readInt();
|
||||
if (serialisationVersion != SERIALISATION_VERSION) {
|
||||
|
||||
@@ -55,13 +55,12 @@ public class PistonCalculator implements Listener {
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
||||
if (event.getItem() == null) {}
|
||||
else if (event.getItem() != null && event.getItem().getType() == Material.SLIME_BALL) {}
|
||||
else if (!event.getItem().getType().isBlock()) {
|
||||
if (event.getItem() == null) {
|
||||
} else if (event.getItem() != null && event.getItem().getType() == Material.SLIME_BALL) {
|
||||
} else if (!event.getItem().getType().isBlock()) {
|
||||
DEBOUNCE.put(event.getPlayer(), System.currentTimeMillis());
|
||||
return;
|
||||
}
|
||||
else return;
|
||||
} else return;
|
||||
if (event.getClickedBlock() == null) return;
|
||||
Block clickedBlock = event.getClickedBlock();
|
||||
Material blockType = clickedBlock.getType();
|
||||
@@ -92,6 +91,7 @@ public class PistonCalculator implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
||||
if (pistOrders.isEmpty()) return;
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
movePistOrders(event.getDirection(), event.getBlocks());
|
||||
pistOrders.values().forEach(PistOrder::calculate);
|
||||
@@ -100,6 +100,7 @@ public class PistonCalculator implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||
if (pistOrders.isEmpty()) return;
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
movePistOrders(event.getDirection(), event.getBlocks());
|
||||
pistOrders.values().forEach(PistOrder::calculate);
|
||||
@@ -122,6 +123,7 @@ public class PistonCalculator implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if (pistOrders.isEmpty()) return;
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
pistOrders.values().forEach(PistOrder::calculate);
|
||||
}, 1);
|
||||
@@ -129,6 +131,7 @@ public class PistonCalculator implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
if (pistOrders.isEmpty()) return;
|
||||
if (pistOrders.containsKey(event.getBlock().getLocation())) {
|
||||
PistOrder pistOrder = pistOrders.remove(event.getBlock().getLocation());
|
||||
pistOrder.server.close();
|
||||
@@ -276,7 +279,8 @@ public class PistonCalculator implements Listener {
|
||||
immovableBlocks.add(block.getLocation());
|
||||
return;
|
||||
}
|
||||
if (facing != direction && (block.equals(origin) || block.getRelative(facing.getOppositeFace()).equals(origin))) return;
|
||||
if (facing != direction && (block.equals(origin) || block.getRelative(facing.getOppositeFace()).equals(origin)))
|
||||
return;
|
||||
if (!movedBlocks.contains(block.getLocation())) toCalc.add(block);
|
||||
}
|
||||
}
|
||||
@@ -372,12 +376,4 @@ public class PistonCalculator implements Listener {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isPiston(Block block) {
|
||||
BlockData blockData = block.getBlockData();
|
||||
if (blockData instanceof Piston) {
|
||||
return !((Piston) blockData).isExtended();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
@@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.worldedit;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.region.Point;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.utils.FlatteningWrapper;
|
||||
import de.steamwar.core.WorldEditRenderer;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@@ -76,10 +77,10 @@ public class SelectAdjacent implements Listener {
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if (!event.hasItem()) return;
|
||||
if (event.getItem().getType() != Material.WOODEN_AXE) return;
|
||||
if (!event.getPlayer().isSneaking()) return;
|
||||
if (event.getAction() != Action.LEFT_CLICK_BLOCK) return;
|
||||
Selector selector = selectors.get(event.getPlayer());
|
||||
if (selector != null) selector.cancel();
|
||||
if (!event.getPlayer().isSneaking()) return;
|
||||
if (event.getAction() != Action.LEFT_CLICK_BLOCK) return;
|
||||
Material material = event.getPlayer().getInventory().getItemInOffHand().getType();
|
||||
if (material.isAir()) {
|
||||
selector = new Selector(event.getClickedBlock(), event.getPlayer(), __ -> true);
|
||||
@@ -111,6 +112,8 @@ public class SelectAdjacent implements Listener {
|
||||
private Set<Location> seen = new HashSet<>();
|
||||
private Set<Location> toCalc = new HashSet<>();
|
||||
|
||||
private Region.Area area;
|
||||
|
||||
public Selector(Block block, Player player, Predicate<Material> predicate) {
|
||||
this.predicate = predicate;
|
||||
toCalc.add(block.getLocation());
|
||||
@@ -121,6 +124,16 @@ public class SelectAdjacent implements Listener {
|
||||
maxY = block.getY();
|
||||
maxZ = block.getZ();
|
||||
|
||||
Region region = Region.getRegion(block.getLocation());
|
||||
area = Region.Area.EMPTY;
|
||||
if (region.getBuildArea().inRegion(block.getLocation(), true)) {
|
||||
area = region.getBuildArea();
|
||||
} else if (region.getTestblockArea().inRegion(block.getLocation(), true)) {
|
||||
area = region.getTestblockArea();
|
||||
} else if (region.getArea().inRegion(block.getLocation(), true)) {
|
||||
area = region.getArea();
|
||||
}
|
||||
|
||||
bukkitTask = Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> {
|
||||
run();
|
||||
|
||||
@@ -158,6 +171,7 @@ public class SelectAdjacent implements Listener {
|
||||
if (block.isEmpty() || block.isLiquid()) continue;
|
||||
if (!predicate.test(block.getType())) continue;
|
||||
seen.add(location);
|
||||
if (!area.inRegion(block.getLocation(), true)) continue;
|
||||
|
||||
minX = Math.min(minX, location.getBlockX());
|
||||
maxX = Math.max(maxX, location.getBlockX());
|
||||
|
||||
@@ -23,7 +23,7 @@ public class BackupScheduler implements Enable {
|
||||
public void run() {
|
||||
Iterator<Region> regionsToBackup = RegionSystem.INSTANCE.getRegions()
|
||||
.filter(region -> region.getFlags().has(Flag.CHANGED).isReadable())
|
||||
.filter(region -> region.getFlags().get(Flag.CHANGED).get() == ChangedMode.HAS_CHANGE)
|
||||
.filter(region -> region.getFlags().get(Flag.CHANGED).getWithDefault() == ChangedMode.HAS_CHANGE)
|
||||
.iterator();
|
||||
if (!regionsToBackup.hasNext()) return;
|
||||
doBackup(regionsToBackup);
|
||||
|
||||
@@ -29,6 +29,9 @@ public interface FlagStorage {
|
||||
@NonNull
|
||||
<T extends Enum<T> & Flag.Value<T>> RegionFlagPolicy has(@NonNull Flag<T> flag);
|
||||
|
||||
/**
|
||||
* Returns true if the flag was changed and did not already contain the provided value
|
||||
*/
|
||||
<T extends Enum<T> & Flag.Value<T>> boolean set(@NonNull Flag<T> flag, @NonNull T value);
|
||||
|
||||
@NonNull
|
||||
|
||||
@@ -121,7 +121,7 @@ public class GameModeConfig {
|
||||
private void load(ConfigurationSection section) {
|
||||
Active = section.getBoolean("Active", false);
|
||||
ObfuscateWith = Material.getMaterial(section.getString("ObfuscateWith", "END_STONE"));
|
||||
HiddenBlocks = section.getStringList("HiddenBlocks").stream().map(FlatteningWrapper.impl::getMaterial).filter(Objects::nonNull).collect(Collectors.toUnmodifiableSet());
|
||||
HiddenBlocks = section.getStringList("HiddenBlocks").stream().map(String::toUpperCase).map(FlatteningWrapper.impl::getMaterial).filter(Objects::nonNull).collect(Collectors.toUnmodifiableSet());
|
||||
HiddenBlockEntities = Collections.unmodifiableSet(new HashSet<>(section.getStringList("HiddenBlockEntities")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,9 +66,12 @@ public class FixedFlagStorage implements FlagStorage {
|
||||
@Override
|
||||
public <T extends Enum<T> & Flag.Value<T>> boolean set(@NonNull Flag<T> flag, @NonNull T value) {
|
||||
if (has(flag).isWritable()) {
|
||||
data.put(flag.name(), value.name());
|
||||
WorldData.write();
|
||||
return flagMap.put(flag, value) != value;
|
||||
boolean hasChanged = flagMap.put(flag, value) != value;
|
||||
if (hasChanged) {
|
||||
data.put(flag.name(), value.name());
|
||||
WorldData.write();
|
||||
}
|
||||
return hasChanged;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class FixedRegion implements Region {
|
||||
private final File file;
|
||||
|
||||
public BackupImpl(File file) {
|
||||
super(RegionBackups.BackupType.AUTOMATIC, file.getName().replace(' ', '_'), flagStorage);
|
||||
super(RegionBackups.BackupType.AUTOMATIC, file.getName().replace(' ', '_').replace(".schem", ""), flagStorage);
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
@@ -253,12 +253,10 @@ public class FixedRegion implements Region {
|
||||
Point maxPointTestblockExtension = maxPointTestblock.add(prototype.getTestblock().getExtensionPositiveX(), prototype.getTestblock().getExtensionPositiveY(), prototype.getTestblock().getExtensionPositiveZ());
|
||||
|
||||
Point copyPoint;
|
||||
if (!prototype.getTestblock().isHasCopyPoint() && (prototype.getCopyPointOffsetX() != 0 || prototype.getCopyPointOffsetY() != 0 || prototype.getCopyPointOffsetZ() != 0)) {
|
||||
copyPoint = minPoint.add(prototype.getCopyPointOffsetX(), prototype.getCopyPointOffsetY(), prototype.getCopyPointOffsetZ());
|
||||
} else if (prototype.getTestblock().getCopyOffsetX() != 0 || prototype.getTestblock().getCopyOffsetY() != 0 || prototype.getTestblock().getCopyOffsetZ() != 0) {
|
||||
if (prototype.getTestblock().getCopyOffsetX() != 0 || prototype.getTestblock().getCopyOffsetY() != 0 || prototype.getTestblock().getCopyOffsetZ() != 0) {
|
||||
copyPoint = minPointTestblock.add(prototype.getTestblock().getCopyOffsetX(), prototype.getTestblock().getCopyOffsetY(), prototype.getTestblock().getCopyOffsetZ());
|
||||
} else {
|
||||
copyPoint = minPointTestblock.add(prototype.getTestblock().getSizeX() / 2, 0, prototype.getTestblock().getSizeZ());
|
||||
copyPoint = minPointTestblock.add(prototype.getTestblock().getSizeX() / 2, 0, -1);
|
||||
}
|
||||
|
||||
testblock = new Area() {
|
||||
|
||||
26
CommonCore/Linkage/build.gradle.kts
Normal file
26
CommonCore/Linkage/build.gradle.kts
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
steamwar.java
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(libs.classindex)
|
||||
}
|
||||
163
CommonCore/Linkage/src/de/steamwar/linkage/AbstractLinker.java
Normal file
163
CommonCore/Linkage/src/de/steamwar/linkage/AbstractLinker.java
Normal file
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* 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.linkage;
|
||||
|
||||
import de.steamwar.linkage.api.Disable;
|
||||
import de.steamwar.linkage.api.Enable;
|
||||
import lombok.NonNull;
|
||||
import lombok.experimental.StandardException;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public abstract class AbstractLinker<T> {
|
||||
|
||||
protected final T plugin;
|
||||
private Map<Class<?>, Object> instances = new HashMap<>();
|
||||
|
||||
protected AbstractLinker(@NonNull T plugin) {
|
||||
this.plugin = plugin;
|
||||
instances.put(plugin.getClass(), plugin);
|
||||
}
|
||||
|
||||
@StandardException
|
||||
public static class LinkException extends Exception {
|
||||
}
|
||||
|
||||
public final void link() throws LinkException {
|
||||
List<Class<?>> classes;
|
||||
try {
|
||||
classes = new BufferedReader(new InputStreamReader(plugin.getClass().getResourceAsStream("/META-INF/annotations/de.steamwar.linkage.Linked")))
|
||||
.lines()
|
||||
.map(s -> {
|
||||
try {
|
||||
return Class.forName(s, false, plugin.getClass().getClassLoader());
|
||||
} catch (ClassNotFoundException | NoClassDefFoundError e) {
|
||||
throw new SecurityException(e.getMessage(), e);
|
||||
}
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
} catch (SecurityException e) {
|
||||
Throwable cause = e.getCause();
|
||||
throw new LinkException(cause.getMessage(), cause);
|
||||
}
|
||||
|
||||
try {
|
||||
classes.forEach(clazz -> {
|
||||
MinVersion minVersion = clazz.getAnnotation(MinVersion.class);
|
||||
MaxVersion maxVersion = clazz.getAnnotation(MaxVersion.class);
|
||||
if (!versionCheck(clazz, minVersion, maxVersion)) return;
|
||||
EventMode eventMode = clazz.getAnnotation(EventMode.class);
|
||||
if (!eventModeCheck(clazz, eventMode)) return;
|
||||
PluginCheck[] pluginChecks = clazz.getAnnotationsByType(PluginCheck.class);
|
||||
for (PluginCheck pluginCheck : pluginChecks) {
|
||||
if (!pluginCheck(clazz, pluginCheck)) return;
|
||||
}
|
||||
|
||||
Object any;
|
||||
try {
|
||||
any = clazz.newInstance();
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
throw new SecurityException(e.getMessage(), e);
|
||||
}
|
||||
instances.put(clazz, any);
|
||||
|
||||
if (any instanceof Enable) {
|
||||
((Enable) any).enable();
|
||||
}
|
||||
linkObject(any);
|
||||
});
|
||||
} catch (SecurityException e) {
|
||||
Throwable cause = e.getCause();
|
||||
throw new LinkException(cause.getMessage(), cause);
|
||||
}
|
||||
|
||||
try {
|
||||
instances.forEach((clazz, o) -> {
|
||||
for (Field field : clazz.getFields()) {
|
||||
if (field.getAnnotation(LinkedInstance.class) != null) {
|
||||
System.out.println("Setting " + field.getName() + " to " + instances.get(field.getType()));
|
||||
try {
|
||||
field.set(o, instances.get(field.getType()));
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new SecurityException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (SecurityException e) {
|
||||
Throwable cause = e.getCause();
|
||||
throw new LinkException(cause.getMessage(), cause);
|
||||
}
|
||||
}
|
||||
|
||||
public final void unlink() {
|
||||
instances.forEach((aClass, any) -> {
|
||||
unlinkObject(any);
|
||||
if (any instanceof Disable) {
|
||||
((Disable) any).disable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public final void addLinkableInstance(@NonNull Object instance) {
|
||||
instances.put(instance.getClass(), instance);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the clazz passes the checks {@code false} otherwise
|
||||
*/
|
||||
protected boolean versionCheck(@NonNull Class<?> clazz, MinVersion minVersion, MaxVersion maxVersion) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the clazz passes the checks {@code false} otherwise
|
||||
*/
|
||||
protected boolean pluginCheck(@NonNull Class<?> clazz, PluginCheck pluginCheck) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the clazz passes the checks {@code false} otherwise
|
||||
*/
|
||||
protected boolean eventModeCheck(@NonNull Class<?> clazz, EventMode eventMode) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* There is no need in calling {@link Enable#enable()} by this method.
|
||||
*/
|
||||
protected void linkObject(Object any) {
|
||||
}
|
||||
|
||||
/**
|
||||
* There is no need in calling {@link Disable#disable()} ()} by this method.
|
||||
*/
|
||||
protected void unlinkObject(Object any) {
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2021 SteamWar.de-Serverteam
|
||||
* 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
|
||||
@@ -17,21 +17,15 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.linkage.specific;
|
||||
package de.steamwar.linkage;
|
||||
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import org.bukkit.entity.Player;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
public interface ScoreboardItem {
|
||||
|
||||
/**
|
||||
* Returns one Scoreboard line. If {@code null} result will be ignored.
|
||||
* If return value contains {@code '?'} it will be replaced to the color
|
||||
* code of the current {@link Region}.
|
||||
*
|
||||
* @param player the player to create the scoreboard line for
|
||||
* @param region the region the player is in
|
||||
* @return the String to send, can be {@code null}
|
||||
*/
|
||||
String getString(Player player, Region region);
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
public @interface EventMode {
|
||||
boolean value();
|
||||
}
|
||||
@@ -25,4 +25,5 @@ dependencies {
|
||||
api(project(":CommonCore:SQL"))
|
||||
api(project(":CommonCore:Network"))
|
||||
api(project(":CommonCore:Data"))
|
||||
api(project(":CommonCore:Linkage"))
|
||||
}
|
||||
|
||||
@@ -87,9 +87,7 @@ public class WorldEditRendererWrapper20 implements WorldEditRendererWrapper {
|
||||
box = new CWireframe(server);
|
||||
boxPair.set(clipboard, box);
|
||||
}
|
||||
box.setPos1(null).setPos2(null);
|
||||
box.setPos1(pos1.toLocation(player.getWorld()));
|
||||
box.setPos2(pos2.toLocation(player.getWorld()));
|
||||
box.setPos1And2(pos1.toLocation(player.getWorld()), pos2.toLocation(player.getWorld()));
|
||||
box.setWidth(width);
|
||||
box.setBlock(block);
|
||||
}
|
||||
|
||||
@@ -59,6 +59,14 @@ public class CLine extends CEntity {
|
||||
return this;
|
||||
}
|
||||
|
||||
public CLine setFromAndTo(Location from, Location to) {
|
||||
if (Objects.equals(from, this.from) && Objects.equals(to, this.to)) return this;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
tick();
|
||||
return this;
|
||||
}
|
||||
|
||||
public CLine setFrom(Location from) {
|
||||
return checkAndSet(this.from, from, location -> this.from = location);
|
||||
}
|
||||
@@ -99,7 +107,16 @@ public class CLine extends CEntity {
|
||||
|
||||
@Override
|
||||
void tick() {
|
||||
if (from == null || to == null) return;
|
||||
if (from == null || to == null) {
|
||||
if (startLine != null) startLine.hide(true);
|
||||
if (middleLine != null) middleLine.hide(true);
|
||||
if (endLine != null) endLine.hide(true);
|
||||
return;
|
||||
} else {
|
||||
if (startLine != null) startLine.hide(false);
|
||||
if (middleLine != null) middleLine.hide(false);
|
||||
if (endLine != null) endLine.hide(false);
|
||||
}
|
||||
if (hide) return;
|
||||
updateStart();
|
||||
updateMiddle();
|
||||
|
||||
@@ -22,11 +22,9 @@ package de.steamwar.entity;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.util.Consumer;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Compound Box (12 CLine)
|
||||
@@ -46,6 +44,13 @@ public class CWireframe extends CEntity {
|
||||
}
|
||||
}
|
||||
|
||||
public CWireframe setPos1And2(Location pos1, Location pos2) {
|
||||
this.pos1 = pos1;
|
||||
this.pos2 = pos2;
|
||||
updateAndSpawnLines();
|
||||
return this;
|
||||
}
|
||||
|
||||
public CWireframe setPos1(Location pos1) {
|
||||
this.pos1 = pos1;
|
||||
updateAndSpawnLines();
|
||||
@@ -75,29 +80,30 @@ public class CWireframe extends CEntity {
|
||||
}
|
||||
|
||||
private void updateAndSpawnLines() {
|
||||
if (pos1 == null || pos2 == null) return;
|
||||
List<CLine> lines = getEntitiesByType(CLine.class);
|
||||
if (pos1 == null || pos2 == null) {
|
||||
lines.forEach(line -> line.setFrom(null).setTo(null));
|
||||
return;
|
||||
}
|
||||
|
||||
World world = pos1.getWorld();
|
||||
Vector min = Vector.getMinimum(pos1.toVector(), pos2.toVector());
|
||||
Vector max = Vector.getMaximum(pos1.toVector(), pos2.toVector())
|
||||
.add(new Vector(1 - width, 1 - width, 1 - width));
|
||||
|
||||
List<CLine> lines = getEntitiesByType(CLine.class);
|
||||
lines.forEach(line -> line.setFrom(null).setTo(null));
|
||||
lines.get(0).setFromAndTo(new Vector(min.getX(), min.getY(), min.getZ()).toLocation(world), new Vector(max.getX() + width, min.getY(), min.getZ()).toLocation(world));
|
||||
lines.get(1).setFromAndTo(new Vector(min.getX(), max.getY(), min.getZ()).toLocation(world), new Vector(max.getX() + width, max.getY(), min.getZ()).toLocation(world));
|
||||
lines.get(2).setFromAndTo(new Vector(min.getX(), min.getY(), max.getZ()).toLocation(world), new Vector(max.getX() + width, min.getY(), max.getZ()).toLocation(world));
|
||||
lines.get(3).setFromAndTo(new Vector(min.getX(), max.getY(), max.getZ()).toLocation(world), new Vector(max.getX() + width, max.getY(), max.getZ()).toLocation(world));
|
||||
|
||||
lines.get(0).setFrom(new Vector(min.getX(), min.getY(), min.getZ()).toLocation(world)).setTo(new Vector(max.getX() + width, min.getY(), min.getZ()).toLocation(world));
|
||||
lines.get(1).setFrom(new Vector(min.getX(), max.getY(), min.getZ()).toLocation(world)).setTo(new Vector(max.getX() + width, max.getY(), min.getZ()).toLocation(world));
|
||||
lines.get(2).setFrom(new Vector(min.getX(), min.getY(), max.getZ()).toLocation(world)).setTo(new Vector(max.getX() + width, min.getY(), max.getZ()).toLocation(world));
|
||||
lines.get(3).setFrom(new Vector(min.getX(), max.getY(), max.getZ()).toLocation(world)).setTo(new Vector(max.getX() + width, max.getY(), max.getZ()).toLocation(world));
|
||||
lines.get(4).setFromAndTo(new Vector(min.getX(), min.getY(), min.getZ()).toLocation(world), new Vector(min.getX(), max.getY() + width, min.getZ()).toLocation(world));
|
||||
lines.get(5).setFromAndTo(new Vector(max.getX(), min.getY(), min.getZ()).toLocation(world), new Vector(max.getX(), max.getY() + width, min.getZ()).toLocation(world));
|
||||
lines.get(6).setFromAndTo(new Vector(min.getX(), min.getY(), max.getZ()).toLocation(world), new Vector(min.getX(), max.getY() + width, max.getZ()).toLocation(world));
|
||||
lines.get(7).setFromAndTo(new Vector(max.getX(), min.getY(), max.getZ()).toLocation(world), new Vector(max.getX(), max.getY() + width, max.getZ()).toLocation(world));
|
||||
|
||||
lines.get(4).setFrom(new Vector(min.getX(), min.getY(), min.getZ()).toLocation(world)).setTo(new Vector(min.getX(), max.getY() + width, min.getZ()).toLocation(world));
|
||||
lines.get(5).setFrom(new Vector(max.getX(), min.getY(), min.getZ()).toLocation(world)).setTo(new Vector(max.getX(), max.getY() + width, min.getZ()).toLocation(world));
|
||||
lines.get(6).setFrom(new Vector(min.getX(), min.getY(), max.getZ()).toLocation(world)).setTo(new Vector(min.getX(), max.getY() + width, max.getZ()).toLocation(world));
|
||||
lines.get(7).setFrom(new Vector(max.getX(), min.getY(), max.getZ()).toLocation(world)).setTo(new Vector(max.getX(), max.getY() + width, max.getZ()).toLocation(world));
|
||||
|
||||
lines.get(8).setFrom(new Vector(min.getX(), min.getY(), min.getZ()).toLocation(world)).setTo(new Vector(min.getX(), min.getY(), max.getZ() + width).toLocation(world));
|
||||
lines.get(9).setFrom(new Vector(max.getX(), min.getY(), min.getZ()).toLocation(world)).setTo(new Vector(max.getX(), min.getY(), max.getZ() + width).toLocation(world));
|
||||
lines.get(10).setFrom(new Vector(min.getX(), max.getY(), min.getZ()).toLocation(world)).setTo(new Vector(min.getX(), max.getY(), max.getZ() + width).toLocation(world));
|
||||
lines.get(11).setFrom(new Vector(max.getX(), max.getY(), min.getZ()).toLocation(world)).setTo(new Vector(max.getX(), max.getY(), max.getZ() + width).toLocation(world));
|
||||
lines.get(8).setFromAndTo(new Vector(min.getX(), min.getY(), min.getZ()).toLocation(world), new Vector(min.getX(), min.getY(), max.getZ() + width).toLocation(world));
|
||||
lines.get(9).setFromAndTo(new Vector(max.getX(), min.getY(), min.getZ()).toLocation(world), new Vector(max.getX(), min.getY(), max.getZ() + width).toLocation(world));
|
||||
lines.get(10).setFromAndTo(new Vector(min.getX(), max.getY(), min.getZ()).toLocation(world), new Vector(min.getX(), max.getY(), max.getZ() + width).toLocation(world));
|
||||
lines.get(11).setFromAndTo(new Vector(max.getX(), max.getY(), min.getZ()).toLocation(world), new Vector(max.getX(), max.getY(), max.getZ() + width).toLocation(world));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ package de.steamwar.inventory;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.core.FlatteningWrapper;
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import org.bukkit.Material;
|
||||
@@ -216,8 +217,10 @@ public class SWItem {
|
||||
}
|
||||
|
||||
public SWItem setCustomModelData(int customModelData) {
|
||||
itemMeta.setCustomModelData(customModelData);
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
if (Core.getVersion() > 12) {
|
||||
itemMeta.setCustomModelData(customModelData);
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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.linkage;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.message.Message;
|
||||
import de.steamwar.network.packets.PacketHandler;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class SpigotLinker extends AbstractLinker<JavaPlugin> {
|
||||
|
||||
private final Message message;
|
||||
|
||||
public SpigotLinker(@NonNull JavaPlugin plugin, Message message) {
|
||||
super(plugin);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean versionCheck(@NonNull Class<?> clazz, MinVersion minVersion, MaxVersion maxVersion) {
|
||||
if (minVersion != null && Core.getVersion() < minVersion.value()) {
|
||||
return false;
|
||||
}
|
||||
if (maxVersion != null && Core.getVersion() > maxVersion.value()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean pluginCheck(@NonNull Class<?> clazz, PluginCheck pluginCheck) {
|
||||
if (pluginCheck.has() == PluginCheck.Has.THIS && Bukkit.getPluginManager().getPlugin(pluginCheck.value()) != null) {
|
||||
return true;
|
||||
}
|
||||
if (pluginCheck.has() == PluginCheck.Has.NOT && Bukkit.getPluginManager().getPlugin(pluginCheck.value()) == null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void linkObject(Object any) {
|
||||
if (any instanceof SWCommand) {
|
||||
((SWCommand) any).setMessage(message);
|
||||
}
|
||||
if (any instanceof Listener) {
|
||||
Bukkit.getPluginManager().registerEvents((Listener) any, plugin);
|
||||
}
|
||||
if (any instanceof PacketHandler) {
|
||||
((PacketHandler) any).register();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void unlinkObject(Object any) {
|
||||
if (any instanceof Listener) {
|
||||
HandlerList.unregisterAll((Listener) any);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,9 @@ java {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(libs.classindex)
|
||||
annotationProcessor(libs.classindex)
|
||||
|
||||
annotationProcessor(libs.velocityapi)
|
||||
compileOnly(libs.velocity)
|
||||
compileOnly(libs.viaapi)
|
||||
|
||||
@@ -19,17 +19,21 @@
|
||||
|
||||
package de.steamwar.velocitycore;
|
||||
|
||||
import de.steamwar.linkage.EventMode;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
class Broadcaster {
|
||||
@Linked
|
||||
@EventMode(false)
|
||||
public class Broadcaster {
|
||||
|
||||
private final List<String> broadcasts = VelocityCore.get().getConfig().getBroadcasts();
|
||||
private int lastBroadCast = 0;
|
||||
|
||||
Broadcaster() {
|
||||
public Broadcaster() {
|
||||
if(!broadcasts.isEmpty())
|
||||
VelocityCore.schedule(this::broadcast).repeat(10, TimeUnit.MINUTES).schedule();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.velocitycore;
|
||||
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.persistent.Subserver;
|
||||
@@ -36,6 +37,7 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static de.steamwar.persistent.Storage.eventServer;
|
||||
|
||||
@Linked
|
||||
public class EventStarter {
|
||||
|
||||
@Getter
|
||||
|
||||
@@ -29,22 +29,24 @@ import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.scheduler.Scheduler;
|
||||
import de.steamwar.command.*;
|
||||
import de.steamwar.linkage.AbstractLinker;
|
||||
import de.steamwar.linkage.EventMode;
|
||||
import de.steamwar.linkage.LinkedInstance;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.network.packets.PacketHandler;
|
||||
import de.steamwar.persistent.ReloadablePlugin;
|
||||
import de.steamwar.sql.Punishment;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.Team;
|
||||
import de.steamwar.sql.UserElo;
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
import de.steamwar.velocitycore.commands.*;
|
||||
import de.steamwar.velocitycore.commands.PunishmentCommand;
|
||||
import de.steamwar.velocitycore.commands.ServerSwitchCommand;
|
||||
import de.steamwar.velocitycore.commands.TeamCommand;
|
||||
import de.steamwar.velocitycore.discord.DiscordBot;
|
||||
import de.steamwar.velocitycore.discord.DiscordConfig;
|
||||
import de.steamwar.velocitycore.listeners.*;
|
||||
import de.steamwar.velocitycore.mods.*;
|
||||
import de.steamwar.velocitycore.network.handlers.*;
|
||||
import de.steamwar.velocitycore.tablist.TablistManager;
|
||||
import de.steamwar.velocitycore.listeners.PollSystem;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.sql.Driver;
|
||||
@@ -94,9 +96,9 @@ public class VelocityCore implements ReloadablePlugin {
|
||||
@Getter
|
||||
private Config config;
|
||||
private ErrorLogger errorLogger;
|
||||
private TablistManager tablistManager;
|
||||
|
||||
@Getter
|
||||
@LinkedInstance
|
||||
private TeamCommand teamCommand;
|
||||
|
||||
@Inject
|
||||
@@ -104,9 +106,10 @@ public class VelocityCore implements ReloadablePlugin {
|
||||
this.proxyServer = proxyServer;
|
||||
this.logger = logger;
|
||||
this.dataDirectory = dataDirectory;
|
||||
|
||||
}
|
||||
|
||||
private AbstractLinker<ReloadablePlugin> linker;
|
||||
|
||||
@Subscribe
|
||||
@Override
|
||||
public void onProxyInitialization(ProxyInitializeEvent event) {
|
||||
@@ -139,64 +142,11 @@ public class VelocityCore implements ReloadablePlugin {
|
||||
initStaticServers();
|
||||
PollSystem.init();
|
||||
|
||||
new Hostname();
|
||||
new PluginMessage();
|
||||
new Schematica();
|
||||
new Badlion();
|
||||
new FabricModSender();
|
||||
new ReplayMod();
|
||||
new FML2();
|
||||
|
||||
new ConnectionListener();
|
||||
new ChatListener();
|
||||
new BanListener();
|
||||
new CheckListener();
|
||||
new IPSanitizer();
|
||||
new VersionAnnouncer();
|
||||
new TexturePackSystem();
|
||||
|
||||
local = new Node.LocalNode();
|
||||
if(MAIN_SERVER) {
|
||||
//new Node.RemoteNode("lx");
|
||||
}
|
||||
|
||||
new TeamchatCommand();
|
||||
new MsgCommand();
|
||||
new RCommand();
|
||||
new PingCommand();
|
||||
new AlertCommand();
|
||||
new KickCommand();
|
||||
new JoinmeCommand();
|
||||
new TpCommand();
|
||||
HelpCommand helpCommand = new HelpCommand();
|
||||
teamCommand = new TeamCommand();
|
||||
new ServerTeamchatCommand();
|
||||
new DevCommand();
|
||||
new SendCommand();
|
||||
new EventCommand();
|
||||
new EventreloadCommand();
|
||||
new EventRescheduleCommand();
|
||||
new PollCommand();
|
||||
new BugCommand();
|
||||
new WhoisCommand();
|
||||
new RulesCommand();
|
||||
new IgnoreCommand();
|
||||
new UnIgnoreCommand();
|
||||
new PollresultCommand();
|
||||
new ListCommand();
|
||||
new StatCommand();
|
||||
new VerifyCommand();
|
||||
new GDPRQuery();
|
||||
new PlaytimeCommand();
|
||||
new ArenaCommand();
|
||||
new RankCommand();
|
||||
new LocalCommand();
|
||||
new SetLocaleCommand();
|
||||
new BuilderCloudCommand();
|
||||
new CheckCommand();
|
||||
|
||||
new ModCommand();
|
||||
|
||||
// Punishment Commands:
|
||||
new PunishmentCommand("ban", Punishment.PunishmentType.Ban);
|
||||
new PunishmentCommand("mute", Punishment.PunishmentType.Mute);
|
||||
@@ -208,32 +158,20 @@ public class VelocityCore implements ReloadablePlugin {
|
||||
new PunishmentCommand("noteamserver", Punishment.PunishmentType.NoTeamServer);
|
||||
new PunishmentCommand("note", Punishment.PunishmentType.Note);
|
||||
|
||||
if(!config.isEventmode()){
|
||||
new BauCommand(helpCommand);
|
||||
new WebpasswordCommand();
|
||||
new FightCommand();
|
||||
new ChallengeCommand();
|
||||
new HistoricCommand();
|
||||
new ReplayCommand();
|
||||
|
||||
new Broadcaster();
|
||||
new CookieEvents();
|
||||
new StreamingCommand();
|
||||
}else{
|
||||
new EventModeListener();
|
||||
linker = new AbstractLinker<>(this) {
|
||||
@Override
|
||||
protected boolean eventModeCheck(@NonNull Class<?> clazz, EventMode eventMode) {
|
||||
return eventMode == null || eventMode.value() == config.isEventmode();
|
||||
}
|
||||
};
|
||||
try {
|
||||
linker.link();
|
||||
} catch (AbstractLinker.LinkException e) {
|
||||
logger.log(Level.SEVERE, e.getMessage(), e);
|
||||
getProxy().shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
for(PacketHandler handler : new PacketHandler[] {
|
||||
new EloPlayerHandler(), new EloSchemHandler(), new ExecuteCommandHandler(), new FightInfoHandler(),
|
||||
new ImALobbyHandler(), new InventoryCallbackHandler(), new PrepareSchemHandler(), new PlayerSkinHandler(), new AnvilAnswerHandler()
|
||||
})
|
||||
handler.register();
|
||||
|
||||
new EventStarter();
|
||||
new SessionManager();
|
||||
tablistManager = new TablistManager();
|
||||
new SettingsChangedListener();
|
||||
|
||||
schedule(() -> {
|
||||
SteamwarUser.clear();
|
||||
UserElo.clear();
|
||||
@@ -269,8 +207,7 @@ public class VelocityCore implements ReloadablePlugin {
|
||||
logger.log(Level.SEVERE, "Could not shutdown discord bot", e);
|
||||
}
|
||||
|
||||
if(tablistManager != null)
|
||||
tablistManager.disable();
|
||||
linker.unlink();
|
||||
errorLogger.unregister();
|
||||
Statement.closeAll();
|
||||
|
||||
|
||||
@@ -19,11 +19,13 @@
|
||||
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.velocitycore.discord.DiscordBot;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.sql.UserPerm;
|
||||
|
||||
@Linked
|
||||
public class AlertCommand extends SWCommand {
|
||||
|
||||
public AlertCommand() {
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.PlayerChatter;
|
||||
import de.steamwar.persistent.Subserver;
|
||||
@@ -31,6 +32,7 @@ import de.steamwar.velocitycore.VelocityCore;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Linked
|
||||
public class ArenaCommand extends SWCommand {
|
||||
|
||||
public ArenaCommand() {
|
||||
|
||||
@@ -19,16 +19,13 @@
|
||||
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.velocitycore.*;
|
||||
import de.steamwar.velocitycore.inventory.SWInventory;
|
||||
import de.steamwar.velocitycore.inventory.SWItem;
|
||||
import de.steamwar.velocitycore.network.NetworkSender;
|
||||
import de.steamwar.velocitycore.util.BauLock;
|
||||
import de.steamwar.velocitycore.util.BauLockState;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.linkage.EventMode;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.LinkedInstance;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.messages.PlayerChatter;
|
||||
@@ -36,17 +33,25 @@ import de.steamwar.network.packets.server.BaumemberUpdatePacket;
|
||||
import de.steamwar.persistent.Bauserver;
|
||||
import de.steamwar.sql.BauweltMember;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.velocitycore.*;
|
||||
import de.steamwar.velocitycore.inventory.SWInventory;
|
||||
import de.steamwar.velocitycore.inventory.SWItem;
|
||||
import de.steamwar.velocitycore.network.NetworkSender;
|
||||
import de.steamwar.velocitycore.util.BauLock;
|
||||
import de.steamwar.velocitycore.util.BauLockState;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Linked
|
||||
@EventMode(false)
|
||||
public class BauCommand extends SWCommand {
|
||||
|
||||
private final HelpCommand command;
|
||||
@LinkedInstance
|
||||
private HelpCommand command;
|
||||
|
||||
public BauCommand(HelpCommand command) {
|
||||
public BauCommand() {
|
||||
super("bau", "b", "build", "gs");
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
@Register(noTabComplete = true)
|
||||
|
||||
@@ -19,12 +19,13 @@
|
||||
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.persistent.Subserver;
|
||||
import de.steamwar.sql.SWException;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.velocitycore.SubserverSystem;
|
||||
|
||||
@Linked
|
||||
public class BugCommand extends SWCommand {
|
||||
public BugCommand() {
|
||||
super("bug");
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.velocitycore.ArenaMode;
|
||||
import de.steamwar.velocitycore.ServerStarter;
|
||||
import de.steamwar.velocitycore.ServerVersion;
|
||||
@@ -37,6 +38,7 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
@Linked
|
||||
public class BuilderCloudCommand extends SWCommand {
|
||||
|
||||
public BuilderCloudCommand() {
|
||||
|
||||
@@ -22,6 +22,8 @@ package de.steamwar.velocitycore.commands;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.linkage.EventMode;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.messages.PlayerChatter;
|
||||
@@ -35,6 +37,8 @@ import java.util.LinkedList;
|
||||
|
||||
import static de.steamwar.persistent.Storage.challenges;
|
||||
|
||||
@Linked
|
||||
@EventMode(false)
|
||||
public class ChallengeCommand extends SWCommand {
|
||||
|
||||
public ChallengeCommand() {
|
||||
|
||||
@@ -21,6 +21,7 @@ package de.steamwar.velocitycore.commands;
|
||||
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.messages.PlayerChatter;
|
||||
@@ -44,6 +45,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@Linked
|
||||
public class CheckCommand extends SWCommand {
|
||||
private static final Map<SchematicType, SchematicType> fightTypes = new HashMap<>();
|
||||
private static final Map<SchematicType, List<String>> checkQuestions = new HashMap<>();
|
||||
|
||||
@@ -27,6 +27,7 @@ import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.SWCommandUtils;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.messages.PlayerChatter;
|
||||
@@ -43,6 +44,7 @@ import java.net.InetSocketAddress;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Linked
|
||||
public class DevCommand extends SWCommand {
|
||||
|
||||
private final File devServerDir = new File("/configs/DevServer");
|
||||
|
||||
@@ -23,6 +23,7 @@ import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.PlayerChatter;
|
||||
import de.steamwar.persistent.Subserver;
|
||||
@@ -37,6 +38,7 @@ import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Linked
|
||||
public class EventCommand extends SWCommand {
|
||||
|
||||
public EventCommand() {
|
||||
|
||||
@@ -21,6 +21,7 @@ package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.sql.Event;
|
||||
import de.steamwar.sql.EventFight;
|
||||
@@ -32,6 +33,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
@Linked
|
||||
public class EventRescheduleCommand extends SWCommand {
|
||||
|
||||
public EventRescheduleCommand() {
|
||||
|
||||
@@ -20,10 +20,12 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.sql.EventFight;
|
||||
import de.steamwar.sql.UserPerm;
|
||||
|
||||
@Linked
|
||||
public class EventreloadCommand extends SWCommand {
|
||||
public EventreloadCommand() {
|
||||
super("eventreload", UserPerm.MODERATION);
|
||||
|
||||
@@ -21,6 +21,8 @@ package de.steamwar.velocitycore.commands;
|
||||
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.EventMode;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.messages.PlayerChatter;
|
||||
@@ -36,6 +38,8 @@ import net.kyori.adventure.text.event.HoverEvent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
|
||||
@Linked
|
||||
@EventMode(false)
|
||||
public class FightCommand extends SWCommand {
|
||||
|
||||
public FightCommand() {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.messages.Chatter;
|
||||
@@ -31,6 +32,7 @@ import java.io.*;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
@Linked
|
||||
public class GDPRQuery extends SWCommand {
|
||||
|
||||
public GDPRQuery() {
|
||||
|
||||
@@ -20,12 +20,14 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
@Linked
|
||||
public class HelpCommand extends SWCommand {
|
||||
|
||||
public HelpCommand() {
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.EventMode;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.messages.PlayerChatter;
|
||||
@@ -27,6 +29,8 @@ import de.steamwar.velocitycore.ArenaMode;
|
||||
import de.steamwar.velocitycore.ServerStarter;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
|
||||
@Linked
|
||||
@EventMode(false)
|
||||
public class HistoricCommand extends SWCommand {
|
||||
public HistoricCommand() {
|
||||
super("historic");
|
||||
|
||||
@@ -20,10 +20,12 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.sql.IgnoreSystem;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
|
||||
@Linked
|
||||
public class IgnoreCommand extends SWCommand {
|
||||
|
||||
public IgnoreCommand() {
|
||||
|
||||
@@ -20,12 +20,14 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.messages.PlayerChatter;
|
||||
import de.steamwar.sql.UserPerm;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
|
||||
@Linked
|
||||
public class JoinmeCommand extends SWCommand {
|
||||
|
||||
public JoinmeCommand() {
|
||||
|
||||
@@ -21,9 +21,11 @@ package de.steamwar.velocitycore.commands;
|
||||
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.sql.UserPerm;
|
||||
|
||||
@Linked
|
||||
public class KickCommand extends SWCommand {
|
||||
|
||||
public KickCommand() {
|
||||
|
||||
@@ -22,6 +22,7 @@ package de.steamwar.velocitycore.commands;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ServerConnection;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.persistent.Subserver;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
@@ -32,6 +33,7 @@ import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Linked
|
||||
public class ListCommand extends SWCommand {
|
||||
|
||||
public ListCommand() {
|
||||
|
||||
@@ -19,10 +19,12 @@
|
||||
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.velocitycore.listeners.ChatListener;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.messages.PlayerChatter;
|
||||
|
||||
@Linked
|
||||
public class LocalCommand extends SWCommand {
|
||||
|
||||
public LocalCommand() {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.velocitycore.inventory.SWInventory;
|
||||
import de.steamwar.velocitycore.inventory.SWItem;
|
||||
import de.steamwar.velocitycore.inventory.SWListInv;
|
||||
@@ -35,6 +36,7 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Linked
|
||||
public class ModCommand extends SWCommand {
|
||||
|
||||
public ModCommand() {
|
||||
|
||||
@@ -20,17 +20,18 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.proxy.Velocity;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
import de.steamwar.velocitycore.listeners.ChatListener;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.ChatterGroup;
|
||||
import de.steamwar.messages.PlayerChatter;
|
||||
import de.steamwar.sql.IgnoreSystem;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
import de.steamwar.velocitycore.listeners.ChatListener;
|
||||
|
||||
import static de.steamwar.persistent.Storage.lastChats;
|
||||
|
||||
@Linked
|
||||
public class MsgCommand extends SWCommand {
|
||||
|
||||
public MsgCommand() {
|
||||
|
||||
@@ -20,8 +20,10 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.PlayerChatter;
|
||||
|
||||
@Linked
|
||||
public class PingCommand extends SWCommand {
|
||||
|
||||
public PingCommand() {
|
||||
|
||||
@@ -20,11 +20,13 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
|
||||
@Linked
|
||||
public class PlaytimeCommand extends SWCommand {
|
||||
|
||||
public PlaytimeCommand() {
|
||||
|
||||
@@ -19,12 +19,14 @@
|
||||
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.velocitycore.listeners.PollSystem;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.sql.PollAnswer;
|
||||
|
||||
@Linked
|
||||
public class PollCommand extends SWCommand {
|
||||
|
||||
public PollCommand() {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.velocitycore.listeners.PollSystem;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
@@ -28,6 +29,7 @@ import de.steamwar.sql.UserPerm;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Linked
|
||||
public class PollresultCommand extends SWCommand {
|
||||
|
||||
public PollresultCommand() {
|
||||
|
||||
@@ -20,10 +20,12 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.PlayerChatter;
|
||||
|
||||
import static de.steamwar.persistent.Storage.lastChats;
|
||||
|
||||
@Linked
|
||||
public class RCommand extends SWCommand {
|
||||
|
||||
public RCommand() {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
@@ -28,6 +29,7 @@ import de.steamwar.velocitycore.ArenaMode;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Linked
|
||||
public class RankCommand extends SWCommand {
|
||||
|
||||
public RankCommand() {
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.linkage.EventMode;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.velocitycore.ArenaMode;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.velocitycore.ServerStarter;
|
||||
@@ -32,6 +34,8 @@ import de.steamwar.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Linked
|
||||
@EventMode(false)
|
||||
public class ReplayCommand extends SWCommand {
|
||||
|
||||
public ReplayCommand() {
|
||||
|
||||
@@ -20,12 +20,14 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Linked
|
||||
public class RulesCommand extends SWCommand {
|
||||
public RulesCommand() {
|
||||
super("rules", "regeln");
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.velocitypowered.api.proxy.server.ServerInfo;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.persistent.Subserver;
|
||||
@@ -38,6 +39,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Linked
|
||||
public class SendCommand extends SWCommand {
|
||||
|
||||
// /send <server> [<users>]
|
||||
|
||||
@@ -19,11 +19,13 @@
|
||||
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.velocitycore.listeners.ChatListener;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.sql.UserPerm;
|
||||
|
||||
@Linked
|
||||
public class ServerTeamchatCommand extends SWCommand {
|
||||
|
||||
public ServerTeamchatCommand() {
|
||||
|
||||
@@ -20,10 +20,12 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.PlayerChatter;
|
||||
import de.steamwar.network.packets.server.LocaleInvalidationPacket;
|
||||
import de.steamwar.velocitycore.network.NetworkSender;
|
||||
|
||||
@Linked
|
||||
public class SetLocaleCommand extends SWCommand {
|
||||
|
||||
public SetLocaleCommand() {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.velocitycore.Node;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.messages.Chatter;
|
||||
@@ -29,6 +30,7 @@ import java.io.InputStreamReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Linked
|
||||
public class StatCommand extends SWCommand {
|
||||
|
||||
public StatCommand() {
|
||||
|
||||
@@ -20,11 +20,15 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.EventMode;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.persistent.Storage;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.UserPerm;
|
||||
|
||||
@Linked
|
||||
@EventMode(false)
|
||||
public class StreamingCommand extends SWCommand {
|
||||
|
||||
public static boolean isNotStreaming(Chatter sender) {
|
||||
|
||||
@@ -29,6 +29,7 @@ import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.messages.PlayerChatter;
|
||||
@@ -52,6 +53,7 @@ import java.util.stream.Stream;
|
||||
|
||||
import static de.steamwar.persistent.Storage.teamInvitations;
|
||||
|
||||
@Linked
|
||||
public class TeamCommand extends SWCommand {
|
||||
|
||||
public TeamCommand() {
|
||||
|
||||
@@ -19,12 +19,14 @@
|
||||
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.velocitycore.listeners.ChatListener;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.ChatterGroup;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
|
||||
@Linked
|
||||
public class TeamchatCommand extends SWCommand {
|
||||
|
||||
public TeamchatCommand() {
|
||||
|
||||
@@ -22,6 +22,7 @@ package de.steamwar.velocitycore.commands;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ServerConnection;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.velocitycore.*;
|
||||
import de.steamwar.velocitycore.util.BauLock;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
@@ -39,6 +40,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Linked
|
||||
public class TpCommand extends SWCommand {
|
||||
|
||||
public TpCommand(){
|
||||
|
||||
@@ -20,10 +20,12 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.sql.IgnoreSystem;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
|
||||
@Linked
|
||||
public class UnIgnoreCommand extends SWCommand {
|
||||
|
||||
public UnIgnoreCommand() {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
import de.steamwar.velocitycore.discord.util.AuthManager;
|
||||
import de.steamwar.command.SWCommand;
|
||||
@@ -28,6 +29,7 @@ import net.dv8tion.jda.api.entities.User;
|
||||
import java.util.Base64;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@Linked
|
||||
public class VerifyCommand extends SWCommand {
|
||||
|
||||
public VerifyCommand() {
|
||||
|
||||
@@ -20,9 +20,13 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.EventMode;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
|
||||
@Linked
|
||||
@EventMode(false)
|
||||
public class WebpasswordCommand extends SWCommand {
|
||||
|
||||
public WebpasswordCommand() {
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.velocitypowered.api.proxy.Player;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.persistent.Storage;
|
||||
@@ -41,7 +42,7 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
@Linked
|
||||
public class WhoisCommand extends SWCommand {
|
||||
public WhoisCommand() {
|
||||
super("whois");
|
||||
|
||||
@@ -22,6 +22,7 @@ package de.steamwar.velocitycore.listeners;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.connection.LoginEvent;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.sql.BannedUserIPs;
|
||||
@@ -36,6 +37,7 @@ import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Linked
|
||||
public class BanListener extends BasicListener {
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.velocitypowered.api.proxy.ConsoleCommandSource;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ServerConnection;
|
||||
import com.velocitypowered.api.proxy.server.ServerInfo;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.ChatterGroup;
|
||||
import de.steamwar.messages.Message;
|
||||
@@ -50,6 +51,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Linked
|
||||
public class ChatListener extends BasicListener {
|
||||
|
||||
private static final Logger cmdLogger = Logger.getLogger("Command logger");
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.velocitypowered.api.event.connection.DisconnectEvent;
|
||||
import com.velocitypowered.api.event.connection.PostLoginEvent;
|
||||
import com.velocitypowered.api.event.player.ServerConnectedEvent;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.persistent.Bauserver;
|
||||
import de.steamwar.persistent.Subserver;
|
||||
@@ -34,6 +35,7 @@ import de.steamwar.velocitycore.commands.CheckCommand;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Linked
|
||||
public class CheckListener extends BasicListener {
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.velocitypowered.api.event.player.KickedFromServerEvent;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.permission.Tristate;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.persistent.Subserver;
|
||||
@@ -45,6 +46,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@Linked
|
||||
public class ConnectionListener extends BasicListener {
|
||||
|
||||
private static final Set<UUID> newPlayers = new HashSet<>();
|
||||
|
||||
@@ -22,11 +22,15 @@ package de.steamwar.velocitycore.listeners;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.player.CookieReceiveEvent;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import de.steamwar.linkage.EventMode;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.sql.EventFight;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.velocitycore.EventStarter;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
|
||||
@Linked
|
||||
@EventMode(false)
|
||||
public class CookieEvents extends BasicListener {
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -19,27 +19,25 @@
|
||||
|
||||
package de.steamwar.velocitycore.listeners;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.connection.PostLoginEvent;
|
||||
import com.velocitypowered.api.event.player.ServerConnectedEvent;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
|
||||
import de.steamwar.linkage.EventMode;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.persistent.Subserver;
|
||||
import de.steamwar.sql.Event;
|
||||
import de.steamwar.sql.EventFight;
|
||||
import de.steamwar.sql.Referee;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.TeamTeilnahme;
|
||||
import de.steamwar.sql.*;
|
||||
import de.steamwar.velocitycore.EventStarter;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
import net.kyori.adventure.key.Key;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.List;
|
||||
|
||||
@Linked
|
||||
@EventMode(true)
|
||||
public class EventModeListener extends BasicListener {
|
||||
|
||||
public static final Key EVENT_TO_SPECTATE_KEY = Key.key("sw", "event_to_spectate");
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
||||
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
|
||||
import com.velocitypowered.proxy.connection.client.LoginInboundConnection;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.persistent.Reflection;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
import de.steamwar.velocitycore.mods.Hostname;
|
||||
@@ -38,6 +39,7 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@Linked
|
||||
public class IPSanitizer extends BasicListener {
|
||||
|
||||
private static final Map<UUID, InetAddress> trueAddress = new HashMap<>(); // Will likely slightly leak over time
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.velocitypowered.api.proxy.messages.ChannelMessageSource;
|
||||
import com.velocitypowered.api.proxy.messages.LegacyChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||
import com.velocitypowered.proxy.protocol.ProtocolUtils;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.network.packets.NetworkPacket;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
@@ -50,6 +51,7 @@ import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@Linked
|
||||
public class PluginMessage extends BasicListener {
|
||||
|
||||
public static void send(Player player, String legacyChannel, String channel, byte[] data) {
|
||||
|
||||
@@ -22,6 +22,7 @@ package de.steamwar.velocitycore.listeners;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.connection.DisconnectEvent;
|
||||
import com.velocitypowered.api.event.connection.PostLoginEvent;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.sql.AuditLog;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
import de.steamwar.sql.Session;
|
||||
@@ -32,6 +33,7 @@ import java.time.Instant;
|
||||
|
||||
import static de.steamwar.persistent.Storage.sessions;
|
||||
|
||||
@Linked
|
||||
public class SessionManager extends BasicListener {
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -22,11 +22,13 @@ package de.steamwar.velocitycore.listeners;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.player.PlayerSettingsChangedEvent;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
import de.steamwar.velocitycore.network.NetworkSender;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.network.packets.server.LocaleInvalidationPacket;
|
||||
|
||||
@Linked
|
||||
public class SettingsChangedListener extends BasicListener {
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -22,6 +22,7 @@ package de.steamwar.velocitycore.listeners;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.player.ServerPostConnectEvent;
|
||||
import com.velocitypowered.api.proxy.player.ResourcePackInfo;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
@@ -33,6 +34,7 @@ import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
// https://jd.papermc.io/velocity/3.4.0/com/velocitypowered/api/proxy/player/ResourcePackInfo.Builder.html#setHash(byte%5B%5D)
|
||||
@Linked
|
||||
public class TexturePackSystem extends BasicListener {
|
||||
|
||||
private static final File PACKS_DIR = new File("/var/www/packs");
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.server.ServerInfo;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.velocity.platform.VelocityViaConfig;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.network.packets.server.ClientVersionPacket;
|
||||
import de.steamwar.persistent.Subserver;
|
||||
@@ -35,6 +36,7 @@ import de.steamwar.velocitycore.network.NetworkSender;
|
||||
import java.time.Duration;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
@Linked
|
||||
public class VersionAnnouncer extends BasicListener {
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -22,7 +22,9 @@ package de.steamwar.velocitycore.mods;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||
import de.steamwar.linkage.Linked;
|
||||
|
||||
@Linked
|
||||
public class Badlion {
|
||||
// https://github.com/BadlionClient/BadlionClientModAPI
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user