Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2019-11-22 23:12:44 -05:00
4 changed files with 340 additions and 267 deletions

View File

@@ -146,7 +146,7 @@ public class EventType{
public final Player player;
public final Item item;
public final int amount;
public DepositEvent(Tile tile, Player player, Item item, int amount){
this.tile = tile;
this.player = player;
@@ -154,7 +154,7 @@ public class EventType{
this.amount = amount;
}
}
/** Called when the player taps a block. */
public static class TapEvent{
public final Tile tile;
@@ -165,7 +165,7 @@ public class EventType{
this.player = player;
}
}
/** Called when the player sets a specific block. */
public static class TapConfigEvent{
public final Tile tile;
@@ -318,7 +318,7 @@ public class EventType{
/** Called after connecting; when a player recieves world data and is ready to play.*/
public static class PlayerJoin{
public final Player player;
public PlayerJoin(Player player){
this.player = player;
}
@@ -335,11 +335,45 @@ public class EventType{
public static class PlayerLeave{
public final Player player;
public PlayerLeave(Player player){
this.player = player;
}
}
public static class PlayerBanEvent{
public final Player player;
public PlayerBanEvent(Player player){
this.player = player;
}
}
public static class PlayerUnbanEvent{
public final Player player;
public PlayerUnbanEvent(Player player){
this.player = player;
}
}
public static class PlayerIpBanEvent{
public final String ip;
public PlayerIpBanEvent(String ip){
this.ip = ip;
}
}
public static class PlayerIpUnbanEvent{
public final String ip;
public PlayerIpUnbanEvent(String ip){
this.ip = ip;
}
}
}

View File

@@ -3,8 +3,11 @@ package io.anuke.mindustry.net;
import io.anuke.annotations.Annotations.*;
import io.anuke.arc.*;
import io.anuke.arc.collection.*;
import io.anuke.mindustry.Vars;
import static io.anuke.mindustry.Vars.headless;
import static io.anuke.mindustry.game.EventType.*;
public class Administration{
/** All player info. Maps UUIDs to info. This persists throughout restarts. */
@@ -76,7 +79,7 @@ public class Administration{
bannedIPs.add(ip);
save();
Events.fire(new PlayerIpBanEvent(ip));
return true;
}
@@ -88,7 +91,7 @@ public class Administration{
getCreateInfo(id).banned = true;
save();
Events.fire(new PlayerBanEvent(Vars.playerGroup.find(p -> id.equals(p.uuid))));
return true;
}
@@ -108,8 +111,10 @@ public class Administration{
bannedIPs.removeValue(ip, false);
if(found) save();
if(found){
save();
Events.fire(new PlayerIpUnbanEvent(ip));
}
return found;
}
@@ -126,7 +131,7 @@ public class Administration{
info.banned = false;
bannedIPs.removeAll(info.ips, false);
save();
Events.fire(new PlayerUnbanEvent(Vars.playerGroup.find(p -> id.equals(p.uuid))));
return true;
}