Witam mam problem otóż chciałbym zaimplementować timer w tym pluginie, żeby co x sekund usuną wprowadzone zmiany w grze.Jest to plugin do bukkita.
package knopers.Knopers666;
import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import ru.tehkode.permissions.PermissionManager;
import ru.tehkode.permissions.bukkit.PermissionsEx;
public class Wtyczka extends JavaPlugin
{
//1
protected static final Logger log = Logger.getLogger("Minecraft");
//2
@Override
public void onEnable(){
this.saveDefaultConfig();
this.getConfig().options().copyDefaults(true);
}
{
//3
log.info("[Knopers] Enable !");
}
//2
@Override
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
PermissionManager permissionsEx = PermissionsEx.getPermissionManager();
if ((sender instanceof Player)) {
if(permissionsEx.has(((Player)sender), "knopers.command")){
if (command.getName().equalsIgnoreCase("floor"))
{
Player player = (Player) sender;
Location loc = player.getLocation();
loc.add(0, -1, 0);
loc.getBlock().setTypeId(this.getConfig().getInt("item-id"));
player.sendMessage(this.getConfig().getString("succes-msg"));
Location loc1 = player.getLocation();
loc1.add(-1, -1, 0);
loc1.getBlock().setTypeId(30);
Location loc2 = player.getLocation();
loc2.add(-1, -1, -1);
loc2.getBlock().setTypeId(30);
Location loc3 = player.getLocation();
loc3.add(-1, -1, 1);
loc3.getBlock().setTypeId(30);
Location loc4 = player.getLocation();
loc4.add(0, -1, 1);
loc4.getBlock().setTypeId(30);
Location loc5 = player.getLocation();
loc5.add(1, -1, 1);
loc5.getBlock().setTypeId(30);
Location loc6 = player.getLocation();
loc6.add(1, -1, 0);
loc6.getBlock().setTypeId(30);
Location loc7 = player.getLocation();
loc7.add(1, -1, -1);
loc7.getBlock().setTypeId(30);
Location loc8 = player.getLocation();
loc8.add(0, -1, -1);
loc8.getBlock().setTypeId(30);
Location loc9 = player.getLocation();
loc9.add(-2, -1, -1);
loc9.getBlock().setTypeId(30);
Location loc10 = player.getLocation();
loc10.add(-2, -1, -2);
loc10.getBlock().setTypeId(30);
Location loc11 = player.getLocation();
loc11.add(-2, -1, 2);
loc11.getBlock().setTypeId(30);
Location loc12 = player.getLocation();
loc12.add(1, -1, 2);
loc12.getBlock().setTypeId(30);
Location loc13 = player.getLocation();
loc13.add(2, -1, 2);
loc13.getBlock().setTypeId(30);
Location loc14 = player.getLocation();
loc14.add(2, -1, 1);
loc14.getBlock().setTypeId(30);
Location loc15 = player.getLocation();
loc15.add(2, -1, -2);
loc15.getBlock().setTypeId(30);
Location loc16 = player.getLocation();
loc16.add(1, -1, -2);
loc16.getBlock().setTypeId(30);
{
return true;
}
}
}
else
sender.sendMessage(ChatColor.GOLD + "Nie masz uprawnien do uzywania tej komendy!");
return true;
}
return false;
}
}