mirror of
https://github.com/kaboomserver/extras.git
synced 2024-12-02 12:16:59 -05:00
Smarter inventory check on join
This commit is contained in:
parent
9e03cd15f5
commit
d648cc8037
1 changed files with 30 additions and 15 deletions
|
@ -6,6 +6,7 @@ import java.util.UUID;
|
||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -71,12 +72,25 @@ class PlayerConnection implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
void onPlayerJoin(PlayerJoinEvent event) {
|
void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
|
final int fadeIn = 10;
|
||||||
|
final int stay = 160;
|
||||||
|
final int fadeOut = 5;
|
||||||
|
|
||||||
if (player.hasPlayedBefore() == true) {
|
if (player.hasPlayedBefore() == true) {
|
||||||
|
try {
|
||||||
|
player.getInventory().getContents();
|
||||||
|
} catch (Exception exception) {
|
||||||
player.getInventory().clear();
|
player.getInventory().clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
player.sendTitle(ChatColor.GRAY + "Welcome to Kaboom!", "Free OP • Anarchy • Creative", 10, 160, 5);
|
player.sendTitle(
|
||||||
|
ChatColor.GRAY + "Welcome to Kaboom!",
|
||||||
|
"Free OP • Anarchy • Creative",
|
||||||
|
fadeIn,
|
||||||
|
stay,
|
||||||
|
fadeOut
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -86,10 +100,12 @@ class PlayerConnection implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
void onPlayerLogin(PlayerLoginEvent event) {
|
void onPlayerLogin(PlayerLoginEvent event) {
|
||||||
/*if (!(event.getHostname().startsWith("play.kaboom.pw") &&
|
if (!(event.getHostname().startsWith("play.kaboom.pw") &&
|
||||||
event.getHostname().endsWith(":53950"))) {
|
event.getHostname().endsWith(":53950"))) {
|
||||||
event.disallow(Result.KICK_OTHER, "You connected to the server using an outdated server address/IP.\nPlease use the following address/IP:\n\nkaboom.pw");
|
event.disallow(Result.KICK_OTHER, "You connected to the server using an outdated server address/IP.\nPlease use the following address/IP:\n\nkaboom.pw");
|
||||||
} else {*/
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
|
|
||||||
event.allow();
|
event.allow();
|
||||||
|
@ -101,7 +117,6 @@ class PlayerConnection implements Listener {
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
}
|
}
|
||||||
main.playerProfile.remove(player.getName());
|
main.playerProfile.remove(player.getName());
|
||||||
/*}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|
Loading…
Reference in a new issue