SteamWar/BungeeCore
Archiviert
13
2

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 IgnoreCommand() {
super("ignore", null);
}
public IgnoreCommand() {
super("ignore", null);
}
@Override
public void execute(CommandSender sender, String[] args) {
if(args.length < 1) {
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eignore §8[§7Spieler§8]");
return;
}
@Override
public void execute(CommandSender sender, String[] args) {
if(args.length < 1) {
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eignore §8[§7Spieler§8]");
return;
}
if (!(sender instanceof ProxiedPlayer))
return;
ProxiedPlayer p = (ProxiedPlayer) sender;
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
if (!(sender instanceof ProxiedPlayer))
return;
ProxiedPlayer p = (ProxiedPlayer) sender;
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
SteamwarUser target = SteamwarUser.get(args[0]);
SteamwarUser target = SteamwarUser.get(args[0]);
if(target == null){
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht.");
return;
@ -32,11 +32,11 @@ public class IgnoreCommand extends BasicCommand {
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cWie willst du dich selber ignorieren?");
return;
}else if(IgnoreSystem.isIgnored(user, target)){
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDu ignorierst diesen Spieler bereits.");
return;
}
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDu ignorierst diesen Spieler bereits.");
return;
}
IgnoreSystem.ignore(user, target);
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 UnIgnoreCommand() {
super("unignore", null);
}
public UnIgnoreCommand() {
super("unignore", null);
}
@Override
public void execute(CommandSender sender, String[] args) {
if(args.length < 1) {
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eunignore §8[§7Spieler§8]");
return;
}
@Override
public void execute(CommandSender sender, String[] args) {
if(args.length < 1) {
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eunignore §8[§7Spieler§8]");
return;
}
if (!(sender instanceof ProxiedPlayer))
return;
ProxiedPlayer p = (ProxiedPlayer) sender;
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
if (!(sender instanceof ProxiedPlayer))
return;
ProxiedPlayer p = (ProxiedPlayer) sender;
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
SteamwarUser target = SteamwarUser.get(args[0]);
if(target == null){
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht!");
return;
}else if(!IgnoreSystem.isIgnored(user, target)){
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDu ignorierst diesen Spieler nicht.");
return;
}
SteamwarUser target = SteamwarUser.get(args[0]);
if(target == null){
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht!");
return;
}else if(!IgnoreSystem.isIgnored(user, target)){
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDu ignorierst diesen Spieler nicht.");
return;
}
IgnoreSystem.unIgnore(user, target);
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§7Du empfängst nun wieder Nachrichten von §e" + target.getUserName() + "§8.");
}
IgnoreSystem.unIgnore(user, target);
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;
public class IgnoreSystem{
private IgnoreSystem(){}
private IgnoreSystem(){}
public static boolean isIgnored(ProxiedPlayer ignorer, ProxiedPlayer ignored){
SteamwarUser user = SteamwarUser.get(ignorer.getUniqueId());
SteamwarUser target = SteamwarUser.get(ignored.getUniqueId());
return isIgnored(user, target);
}
public static boolean isIgnored(ProxiedPlayer ignorer, ProxiedPlayer ignored){
SteamwarUser user = SteamwarUser.get(ignorer.getUniqueId());
SteamwarUser target = SteamwarUser.get(ignored.getUniqueId());
return isIgnored(user, target);
}
public static boolean isIgnored(SteamwarUser ignorer, SteamwarUser ignored) {
try {
return !SQL.select("SELECT * FROM Ignore WHERE Ignorer = ? AND Ignored = ?", ignorer.getId(), ignored.getId()).next();
} catch (SQLException e) {
throw new SecurityException("Could not check if ignored", e);
}
}
public static boolean isIgnored(SteamwarUser ignorer, SteamwarUser ignored) {
try {
return !SQL.select("SELECT * FROM Ignore WHERE Ignorer = ? AND Ignored = ?", ignorer.getId(), ignored.getId()).next();
} catch (SQLException e) {
throw new SecurityException("Could not check if ignored", e);
}
}
public static void ignore(SteamwarUser ignorer, SteamwarUser ignored) {
SQL.update("INSERT INTO Ignore (Ignorer, Ignored) VALUES (?, ?)", ignorer.getId(), ignored.getId());
}
public static void ignore(SteamwarUser ignorer, SteamwarUser ignored) {
SQL.update("INSERT INTO Ignore (Ignorer, Ignored) VALUES (?, ?)", ignorer.getId(), ignored.getId());
}
public static void unIgnore(SteamwarUser ignorer, SteamwarUser ignored) {
SQL.update("DELETE FROM Ignore WHERE Ignorer = ? AND Ignored = ?", ignorer.getId(), ignored.getId());
}
public static void unIgnore(SteamwarUser ignorer, SteamwarUser ignored) {
SQL.update("DELETE FROM Ignore WHERE Ignorer = ? AND Ignored = ?", ignorer.getId(), ignored.getId());
}
}