mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-04 06:28:57 +00:00
Support for delayed mode setting on player join
This commit is contained in:
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in new issue
Block a user