Archiviert
1
0

Fix indentation and line endings

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2020-08-25 19:18:21 +02:00
Ursprung cc3a5fcf18
Commit bca534473e
3 geänderte Dateien mit 61 neuen und 61 gelöschten Zeilen

Datei anzeigen

@ -8,23 +8,23 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
public class IgnoreCommand extends BasicCommand { public class IgnoreCommand extends BasicCommand {
public IgnoreCommand() { public IgnoreCommand() {
super("ignore", null); super("ignore", null);
} }
@Override @Override
public void execute(CommandSender sender, String[] args) { public void execute(CommandSender sender, String[] args) {
if(args.length < 1) { if(args.length < 1) {
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eignore §8[§7Spieler§8]"); BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eignore §8[§7Spieler§8]");
return; return;
} }
if (!(sender instanceof ProxiedPlayer)) if (!(sender instanceof ProxiedPlayer))
return; return;
ProxiedPlayer p = (ProxiedPlayer) sender; ProxiedPlayer p = (ProxiedPlayer) sender;
SteamwarUser user = SteamwarUser.get(p.getUniqueId()); SteamwarUser user = SteamwarUser.get(p.getUniqueId());
SteamwarUser target = SteamwarUser.get(args[0]); SteamwarUser target = SteamwarUser.get(args[0]);
if(target == null){ if(target == null){
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht."); BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht.");
return; return;
@ -32,11 +32,11 @@ public class IgnoreCommand extends BasicCommand {
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cWie willst du dich selber ignorieren?"); BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cWie willst du dich selber ignorieren?");
return; return;
}else if(IgnoreSystem.isIgnored(user, target)){ }else if(IgnoreSystem.isIgnored(user, target)){
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDu ignorierst diesen Spieler bereits."); BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDu ignorierst diesen Spieler bereits.");
return; return;
} }
IgnoreSystem.ignore(user, target); IgnoreSystem.ignore(user, target);
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§7Du ignorierst nun §e" + target.getUserName() + "§8."); BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§7Du ignorierst nun §e" + target.getUserName() + "§8.");
} }
} }

Datei anzeigen

@ -8,33 +8,33 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
public class UnIgnoreCommand extends BasicCommand { public class UnIgnoreCommand extends BasicCommand {
public UnIgnoreCommand() { public UnIgnoreCommand() {
super("unignore", null); super("unignore", null);
} }
@Override @Override
public void execute(CommandSender sender, String[] args) { public void execute(CommandSender sender, String[] args) {
if(args.length < 1) { if(args.length < 1) {
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eunignore §8[§7Spieler§8]"); BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eunignore §8[§7Spieler§8]");
return; return;
} }
if (!(sender instanceof ProxiedPlayer)) if (!(sender instanceof ProxiedPlayer))
return; return;
ProxiedPlayer p = (ProxiedPlayer) sender; ProxiedPlayer p = (ProxiedPlayer) sender;
SteamwarUser user = SteamwarUser.get(p.getUniqueId()); SteamwarUser user = SteamwarUser.get(p.getUniqueId());
SteamwarUser target = SteamwarUser.get(args[0]); SteamwarUser target = SteamwarUser.get(args[0]);
if(target == null){ if(target == null){
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht!"); BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht!");
return; return;
}else if(!IgnoreSystem.isIgnored(user, target)){ }else if(!IgnoreSystem.isIgnored(user, target)){
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDu ignorierst diesen Spieler nicht."); BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDu ignorierst diesen Spieler nicht.");
return; return;
} }
IgnoreSystem.unIgnore(user, target); IgnoreSystem.unIgnore(user, target);
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§7Du empfängst nun wieder Nachrichten von §e" + target.getUserName() + "§8."); BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§7Du empfängst nun wieder Nachrichten von §e" + target.getUserName() + "§8.");
} }
} }

Datei anzeigen

@ -5,27 +5,27 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.sql.SQLException; import java.sql.SQLException;
public class IgnoreSystem{ public class IgnoreSystem{
private IgnoreSystem(){} private IgnoreSystem(){}
public static boolean isIgnored(ProxiedPlayer ignorer, ProxiedPlayer ignored){ public static boolean isIgnored(ProxiedPlayer ignorer, ProxiedPlayer ignored){
SteamwarUser user = SteamwarUser.get(ignorer.getUniqueId()); SteamwarUser user = SteamwarUser.get(ignorer.getUniqueId());
SteamwarUser target = SteamwarUser.get(ignored.getUniqueId()); SteamwarUser target = SteamwarUser.get(ignored.getUniqueId());
return isIgnored(user, target); return isIgnored(user, target);
} }
public static boolean isIgnored(SteamwarUser ignorer, SteamwarUser ignored) { public static boolean isIgnored(SteamwarUser ignorer, SteamwarUser ignored) {
try { try {
return !SQL.select("SELECT * FROM Ignore WHERE Ignorer = ? AND Ignored = ?", ignorer.getId(), ignored.getId()).next(); return !SQL.select("SELECT * FROM Ignore WHERE Ignorer = ? AND Ignored = ?", ignorer.getId(), ignored.getId()).next();
} catch (SQLException e) { } catch (SQLException e) {
throw new SecurityException("Could not check if ignored", e); throw new SecurityException("Could not check if ignored", e);
} }
} }
public static void ignore(SteamwarUser ignorer, SteamwarUser ignored) { public static void ignore(SteamwarUser ignorer, SteamwarUser ignored) {
SQL.update("INSERT INTO Ignore (Ignorer, Ignored) VALUES (?, ?)", ignorer.getId(), ignored.getId()); SQL.update("INSERT INTO Ignore (Ignorer, Ignored) VALUES (?, ?)", ignorer.getId(), ignored.getId());
} }
public static void unIgnore(SteamwarUser ignorer, SteamwarUser ignored) { public static void unIgnore(SteamwarUser ignorer, SteamwarUser ignored) {
SQL.update("DELETE FROM Ignore WHERE Ignorer = ? AND Ignored = ?", ignorer.getId(), ignored.getId()); SQL.update("DELETE FROM Ignore WHERE Ignorer = ? AND Ignored = ?", ignorer.getId(), ignored.getId());
} }
} }