SteamWar/BungeeCore
Archiviert
13
2

Merge pull request 'Allow Fabric' (#127) from allow-fabric into master

Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
YoyoNow 2020-10-12 12:46:05 +02:00
Commit f99c4580ce
2 geänderte Dateien mit 26 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -80,10 +80,10 @@ public class BungeeCore extends Plugin {
new ConnectionListener(); new ConnectionListener();
new Forge(); new Forge();
new LabyMod(); new LabyMod();
new Fabric();
new ChatListener(); new ChatListener();
new BanListener(); new BanListener();
new CheckListener(); new CheckListener();
new Fabric();
commands.put("/b", null); commands.put("/b", null);
commands.put("/gs", null); commands.put("/gs", null);

Datei anzeigen

@ -15,15 +15,20 @@
You should have received a copy of the GNU Affero General Public License 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/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.steamwar.bungeecore.listeners.mods; package de.steamwar.bungeecore.listeners.mods;
import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Servertype;
import de.steamwar.bungeecore.Storage;
import de.steamwar.bungeecore.Subserver;
import de.steamwar.bungeecore.listeners.BasicListener; import de.steamwar.bungeecore.listeners.BasicListener;
import net.md_5.bungee.api.connection.Connection; import net.md_5.bungee.api.connection.Connection;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
import net.md_5.bungee.api.event.PluginMessageEvent; import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.api.event.ServerSwitchEvent;
import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventHandler;
public class Fabric extends BasicListener { public class Fabric extends BasicListener {
@ -39,7 +44,23 @@ public class Fabric extends BasicListener {
if(new String(e.getData()).contains("fabric")){ if(new String(e.getData()).contains("fabric")){
ProxiedPlayer p = (ProxiedPlayer) sender; ProxiedPlayer p = (ProxiedPlayer) sender;
p.disconnect(BungeeCore.stringToText("§7Die Verwendung von Fabric ist auf §eSteam§8War §7nicht gestattet.")); Storage.fabricPlayers.add(p);
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§7Du hast Fabric installiert. Mit Fabric kannst du nicht auf die Arenen");
}
}
@EventHandler
public void onDisconnect(PlayerDisconnectEvent e){
Storage.fabricPlayers.removeIf(player -> player == e.getPlayer());
}
@EventHandler
public void onServerSwitch(ServerSwitchEvent event) {
if(Subserver.getSubserver(event.getPlayer()) != null
&& Subserver.getSubserver(event.getPlayer()).getType() == Servertype.ARENA
&& Storage.fabricPlayers.contains(event.getPlayer())) {
event.getPlayer().connect(event.getFrom());
BungeeCore.send(event.getPlayer(), BungeeCore.CHAT_PREFIX + "§cDu kannst nicht auf die Arena mit Fabric");
} }
} }
} }