use of fr.glowstoner.fireapi.bigbrother.spy.packets.PacketSpyAction in project FireAPI by FireBlade-Serv.
the class Events method onChat.
@EventHandler(priority = EventPriority.LOWEST)
public void onChat(ChatEvent e) {
ProxiedPlayer pp = (ProxiedPlayer) e.getSender();
if (pp.getServer().getInfo().equals(this.instance.getBungeePlugin().getProxy().getServerInfo("login"))) {
List<String> success = Arrays.asList("/login", "/register");
if (!success.contains(e.getMessage().split(" ")[0])) {
e.setCancelled(true);
}
if (e.isCommand()) {
if (this.instance.getSQL().getCryptPassword(pp.getName()).equals("§default-not-set")) {
// not registered
pp.sendMessage(new TextComponent(this.instance.getAuthentification().getRegisterMessage()));
this.instance.getAuthentification().getRegisterTitle().send(pp);
} else {
// registered
pp.sendMessage(new TextComponent(this.instance.getAuthentification().getLoginMessage()));
this.instance.getAuthentification().getLoginTitle().send(pp);
}
} else {
if (this.instance.getSQL().getCryptPassword(pp.getName()).equals("§default-not-set")) {
// not registered
pp.sendMessage(new TextComponent(this.instance.getAuthentification().getRegisterMessage()));
this.instance.getAuthentification().getRegisterTitle().send(pp);
} else {
// registered
pp.sendMessage(new TextComponent(this.instance.getAuthentification().getLoginMessage()));
this.instance.getAuthentification().getLoginTitle().send(pp);
}
}
} else {
try {
PacketSpyAction ps = new PacketSpyAction(pp.getName(), pp.getAddress().getAddress().getHostAddress(), e.getMessage(), SpyAction.PLAYER_CHAT);
ps.setDateToNow();
this.c.sendPacket(ps);
} catch (IOException e1) {
e1.printStackTrace();
}
if (e.getMessage().startsWith(":")) {
if (this.instance.getRankSystem().hasRankAndSup(pp.getName(), Rank.GUIDE)) {
if (this.scc.getPlayers().containsKey(pp)) {
if (this.scc.getPlayers().get(pp)) {
this.scc.send(pp, e.getMessage().substring(1));
e.setCancelled(true);
}
}
}
}
}
}
use of fr.glowstoner.fireapi.bigbrother.spy.packets.PacketSpyAction in project FireAPI by FireBlade-Serv.
the class Events method onLogin.
@EventHandler
public void onLogin(PostLoginEvent e) {
final ProxiedPlayer pp = e.getPlayer();
pp.setTabHeader(new TextComponent("§6Fireblade-serv"), new TextComponent("§eplay.fireblade-serv.eu"));
if (!this.instance.getSQL().hasFireAccount(pp.getName())) {
this.instance.getSQL().createFireAccount(pp);
}
PacketSpyAction ps = new PacketSpyAction(pp.getName(), pp.getAddress().getAddress().getHostAddress(), "Connection sur le proxy principal.", SpyAction.PLAYER_JOIN);
ps.setDateToNow();
try {
this.c.sendPacket(ps);
} catch (IOException ex) {
ex.printStackTrace();
}
this.stillconnected.add(pp);
this.instance.getBungeePlugin().getProxy().getScheduler().schedule(this.instance.getBungeePlugin(), new Runnable() {
@Override
public void run() {
if (pp != null) {
if (pp.isConnected() && stillconnected.contains(pp)) {
pp.disconnect(new TextComponent("§cVous mettez trop de temps pour vous connecter !"));
}
}
}
}, 15L, TimeUnit.SECONDS);
if (this.instance.getSQL().getCryptPassword(pp.getName()).equals("§default-not-set")) {
// not registered
pp.sendMessage(new TextComponent(this.instance.getAuthentification().getRegisterMessage()));
this.instance.getAuthentification().getRegisterTitle().send(pp);
} else {
// registered
pp.sendMessage(new TextComponent(this.instance.getAuthentification().getLoginMessage()));
this.instance.getAuthentification().getLoginTitle().send(pp);
}
}
Aggregations