Support for delayed mode setting on player join

This commit is contained in:
Marco Cunha committed 2012-08-25 19:52:48 +02:00
1 parent c3d4d372bf
commit 94bea8a158
1 file changed
+43
@@ -0,0 +1,43 @@
package com.palmergames.bukkit.TownyChat.tasks;
import org.bukkit.entity.Player;
import com.palmergames.bukkit.TownyChat.Chat;
import com.palmergames.bukkit.TownyChat.channels.Channel;
import com.palmergames.bukkit.towny.Towny;
/*
*
* Created by RocketRidah
*
*/
public class onPlayerJoinTask implements Runnable {
Chat plugin;
Towny towny;
String playerName;
String mode;
public onPlayerJoinTask(Chat plugin, Player player, Channel defaultChannel) {
super();
this.plugin = plugin;
this.towny = plugin.getTowny();
this.playerName = player.getName();
this.mode = defaultChannel.getName();
}
@Override
public void run() {
if (this.towny.isEnabled()) {
if (!this.towny.isError()) {
Player player = plugin.getServer().getPlayer(playerName);
if (player != null) {
towny.setPlayerMode(player, new String[] { mode }, true);
}
return;
}
}
}
}