mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-11 13:33:54 +00:00
realtime and the superior sword
This commit is contained in:
@ -19,6 +19,8 @@ import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Bans a player", usage = "/<command> <username> [reason] [-nrb]", aliases = "ban")
|
||||
@ -82,6 +84,7 @@ public class Command_gtfo extends FreedomCommand
|
||||
|
||||
String reason = null;
|
||||
Boolean cancelRollback = false;
|
||||
Boolean epicFail = false;
|
||||
if (args.length >= 2)
|
||||
{
|
||||
if (args[args.length - 1].equalsIgnoreCase("-nrb"))
|
||||
@ -92,6 +95,14 @@ public class Command_gtfo extends FreedomCommand
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length - 1), " ");
|
||||
}
|
||||
}
|
||||
if (args[args.length - 1].equalsIgnoreCase("-ef"))
|
||||
{
|
||||
epicFail = true;
|
||||
if (args.length >= 3)
|
||||
{
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length - 1), " ");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
@ -121,6 +132,26 @@ public class Command_gtfo extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
if (epicFail)
|
||||
{
|
||||
for (int i = 0; i < 25; i++)
|
||||
{
|
||||
player.setVelocity(player.getVelocity().clone().add(new Vector(0, 50, 0)));
|
||||
new BukkitRunnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
player.getWorld().strikeLightning(player.getLocation());
|
||||
//FUtil.
|
||||
}
|
||||
}
|
||||
}.runTaskLater(plugin, 2L * 20L);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
FUtil.bcastMsg(player.getName() + " has been a VERY naughty, naughty boy.", ChatColor.RED);
|
||||
|
@ -0,0 +1,64 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Sync your time up with the real world time.", usage = "/<command> <on <utc_offset> | off>", aliases = "rt")
|
||||
public class Command_realtime extends FreedomCommand
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
VPlayer player = plugin.pv.getVerificationPlayer(playerSender);
|
||||
if (args.length == 0 || args.length > 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (args.length == 2)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
int tz;
|
||||
try
|
||||
{
|
||||
tz = Integer.parseInt(args[1]);
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
msg("Invalid UTC offset.");
|
||||
return true;
|
||||
}
|
||||
if (FUtil.timeZoneOutOfBounds(tz))
|
||||
{
|
||||
msg("Invalid UTC offset.");
|
||||
return true;
|
||||
}
|
||||
player.setUtcOffset(tz);
|
||||
player.setRealTime(true);
|
||||
plugin.rt.enable(playerSender);
|
||||
plugin.pv.save();
|
||||
msg("Your in-game time is now synced with real time.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("off"))
|
||||
{
|
||||
if (!player.isRealTime())
|
||||
{
|
||||
msg("You aren't on real time.");
|
||||
return true;
|
||||
}
|
||||
player.setRealTime(false);
|
||||
msg("Your in-game time is no longer synced with real time.");
|
||||
plugin.rt.disable(playerSender);
|
||||
plugin.pv.save();
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -6,7 +6,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.TimerTask;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.shop.ShopData;
|
||||
@ -19,6 +18,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Access the shop", usage = "/<command> <buy <item> | action | list>")
|
||||
@ -57,7 +57,7 @@ public class Command_shop extends FreedomCommand
|
||||
sd.setCoins(sd.getCoins() + 100);
|
||||
plugin.sh.save(sd);
|
||||
msg(prefix + ChatColor.GREEN + "You received your 100 coins!");
|
||||
cooldown(86400, args[0]);
|
||||
cooldown(86400, sender, args[0]);
|
||||
return true;
|
||||
}
|
||||
case "search":
|
||||
@ -67,7 +67,7 @@ public class Command_shop extends FreedomCommand
|
||||
sd.setCoins(sd.getCoins() + amount);
|
||||
plugin.sh.save(sd);
|
||||
msg(prefix + ChatColor.AQUA + location + ChatColor.GREEN + " - Found " + ChatColor.RED + amount + ChatColor.GREEN + " coins!");
|
||||
cooldown(30, args[0]);
|
||||
cooldown(30, sender, args[0]);
|
||||
return true;
|
||||
}
|
||||
case "list":
|
||||
@ -80,11 +80,16 @@ public class Command_shop extends FreedomCommand
|
||||
}
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Player player = getPlayer(args[0]);
|
||||
if (player == null)
|
||||
{
|
||||
msg(PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
ShopData psd = plugin.sh.getData(player);
|
||||
msg(prefix + ChatColor.AQUA + player.getName() + ChatColor.GREEN + "'s balance: " + ChatColor.RED + psd.getCoins());
|
||||
return true;
|
||||
}
|
||||
if (args.length != 2)
|
||||
{
|
||||
@ -150,17 +155,17 @@ public class Command_shop extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
private void cooldown(int seconds, String feature)
|
||||
private void cooldown(int seconds, CommandSender sender, String feature)
|
||||
{
|
||||
featureCooldown.put(sender, feature);
|
||||
FreedomCommandExecutor.timer.schedule(new TimerTask()
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
featureCooldown.remove(sender);
|
||||
}
|
||||
}, seconds * 1000);
|
||||
}.runTaskLater(plugin, seconds * 20);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user