SteamWar/BungeeCore
Archiviert
13
2

Removing Forgeblocker-Toggeling and adding kick delay

Dieser Commit ist enthalten in:
Lixfel 2019-12-31 08:53:43 +01:00
Ursprung fcd09fb3b3
Commit 8f553a663b
3 geänderte Dateien mit 3 neuen und 32 gelöschten Zeilen

Datei anzeigen

@ -81,7 +81,6 @@ public class BungeeCore extends Plugin {
new ChallengeCommand(); new ChallengeCommand();
new TeamCommand(); new TeamCommand();
new ServerTeamchatCommand(); new ServerTeamchatCommand();
new ForgeCommand();
new EventCommand(); new EventCommand();
new EventreloadCommand(); new EventreloadCommand();
new EventRescheduleCommand(); new EventRescheduleCommand();

Datei anzeigen

@ -1,16 +0,0 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.listeners.mods.Forge;
import net.md_5.bungee.api.CommandSender;
public class ForgeCommand extends BasicCommand {
public ForgeCommand() {
super("forge", "bungeecore.softreload");
}
@Override
public void execute(CommandSender sender, String[] args) {
Forge.toggleEnabled();
}
}

Datei anzeigen

@ -23,11 +23,6 @@ public class Forge extends BasicListener {
private static final byte[] REGISTER; private static final byte[] REGISTER;
private static final byte[] HELLO = new byte[]{0, 2, 0, 0, 0, 0}; private static final byte[] HELLO = new byte[]{0, 2, 0, 0, 0, 0};
private static final Set<UUID> unlocked = new HashSet<>(); private static final Set<UUID> unlocked = new HashSet<>();
private static boolean enabled = false;
public static void toggleEnabled(){
enabled = !enabled;
}
static{ static{
ByteBuf buf = UnpooledByteBufAllocator.DEFAULT.directBuffer(7); ByteBuf buf = UnpooledByteBufAllocator.DEFAULT.directBuffer(7);
@ -41,9 +36,6 @@ public class Forge extends BasicListener {
public void onPostLogin(PostLoginEvent event) { public void onPostLogin(PostLoginEvent event) {
ProxiedPlayer player = event.getPlayer(); ProxiedPlayer player = event.getPlayer();
if(!enabled)
return;
synchronized (unlocked) { synchronized (unlocked) {
if(unlocked.contains(player.getUniqueId())){ if(unlocked.contains(player.getUniqueId())){
unlocked.remove(player.getUniqueId()); unlocked.remove(player.getUniqueId());
@ -61,11 +53,6 @@ public class Forge extends BasicListener {
@EventHandler @EventHandler
public void onPluginMessageEvent(PluginMessageEvent e){ public void onPluginMessageEvent(PluginMessageEvent e){
if(!enabled)
return;
BungeeCore.log(e.getSender().getAddress().getHostString() + " " + e.getTag() + " " + Arrays.toString(e.getData()));
if(!e.getTag().equals(FMLHS)) if(!e.getTag().equals(FMLHS))
return; return;
@ -90,14 +77,15 @@ public class Forge extends BasicListener {
bytePos += 1 + data[bytePos]; bytePos += 1 + data[bytePos];
mods.add(Mod.get(new String(name), Mod.Platform.FORGE)); mods.add(Mod.get(new String(name), Mod.Platform.FORGE));
BungeeCore.log(new String(name) + " " + new String(version));
} }
if(Utils.handleMods(p, mods)){ if(Utils.handleMods(p, mods)){
synchronized (unlocked){ synchronized (unlocked){
unlocked.add(p.getUniqueId()); unlocked.add(p.getUniqueId());
} }
p.disconnect(BungeeCore.stringToText("§7Deine installierten Mods wurden überprüft\n\n§aDu kannst nun §eSteam§8War §abetreten")); ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(),
() -> p.disconnect(BungeeCore.stringToText("§7Deine installierten Mods wurden überprüft\n§aDu kannst nun §eSteam§8War §abetreten")),
2, TimeUnit.SECONDS);
ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), () -> { ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), () -> {
synchronized (unlocked) { synchronized (unlocked) {
unlocked.remove(p.getUniqueId()); unlocked.remove(p.getUniqueId());