mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Misc cleanup
Upgraded mp44
This commit is contained in:
parent
56a4493b36
commit
98712619f5
@ -1,9 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,10 +1,8 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -1,20 +1,21 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Command_mp44 extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
//if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin))
|
||||
if (senderIsConsole || sender.isOp())
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
@ -31,13 +32,18 @@ public class Command_mp44 extends TFM_Command
|
||||
|
||||
if (args[0].equalsIgnoreCase("draw"))
|
||||
{
|
||||
playerdata.stopArrowShooter();
|
||||
int schedule_id = Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, new ArrowShooter(sender_p), 1L, 1L);
|
||||
playerdata.startArrowShooter(schedule_id);
|
||||
playerdata.armMP44();
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "mp44 is ARMED! Left click with gunpowder to start firing, left click again to quit.");
|
||||
sender.sendMessage(ChatColor.GREEN + "Type /mp44 sling to disable. -by Madgeek1450");
|
||||
|
||||
sender_p.setItemInHand(new ItemStack(Material.SULPHUR, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
playerdata.stopArrowShooter();
|
||||
playerdata.disarmMP44();
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "mp44 Disarmed.");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -47,21 +53,4 @@ public class Command_mp44 extends TFM_Command
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
class ArrowShooter implements Runnable
|
||||
{
|
||||
private Player _player;
|
||||
|
||||
public ArrowShooter(Player player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Arrow shot_arrow = _player.shootArrow();
|
||||
shot_arrow.setVelocity(shot_arrow.getVelocity().multiply(2.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -6,7 +6,6 @@ import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_RadarData;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import me.desmin88.mobdisguise.api.MobDisguiseAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -1,9 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -5,10 +5,12 @@ import java.util.Map;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Command_tossmob extends TFM_Command
|
||||
{
|
||||
@ -82,6 +84,8 @@ public class Command_tossmob extends TFM_Command
|
||||
sender.sendMessage(ChatColor.GREEN + "MobThrower is enabled. Creature: " + creature + " - Speed: " + speed + ".");
|
||||
sender.sendMessage(ChatColor.GREEN + "Left click while holding a stick to throw mobs!");
|
||||
sender.sendMessage(ChatColor.GREEN + "Type '/tossmob off' to disable. -By Madgeek1450");
|
||||
|
||||
sender_p.setItemInHand(new ItemStack(Material.STICK, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -23,6 +23,8 @@ public class TFM_EntityListener extends EntityListener
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
event.setYield(0.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,6 +71,24 @@ public class TFM_PlayerListener extends PlayerListener
|
||||
rezzed_mob.setVelocity(direction.multiply(playerdata.mobThrowerSpeed()));
|
||||
playerdata.enqueueMob(rezzed_mob);
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
else if (event.getMaterial() == Material.SULPHUR)
|
||||
{
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(player, plugin);
|
||||
|
||||
if (playerdata.isMP44Armed())
|
||||
{
|
||||
if (playerdata.toggleMP44Firing())
|
||||
{
|
||||
playerdata.startArrowShooter(plugin);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerdata.stopArrowShooter();
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -239,13 +257,13 @@ public class TFM_PlayerListener extends PlayerListener
|
||||
public void onPlayerKick(PlayerKickEvent event)
|
||||
{
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(event.getPlayer(), plugin);
|
||||
playerdata.stopArrowShooter();
|
||||
playerdata.disarmMP44();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(event.getPlayer(), plugin);
|
||||
playerdata.stopArrowShooter();
|
||||
playerdata.disarmMP44();
|
||||
}
|
||||
}
|
||||
|
@ -5,12 +5,11 @@ import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.*;
|
||||
|
||||
public class TFM_UserInfo
|
||||
{
|
||||
private Player player;
|
||||
private boolean user_frozen = false;
|
||||
private int msg_count = 0;
|
||||
private int block_destroy_total = 0;
|
||||
@ -30,9 +29,12 @@ public class TFM_UserInfo
|
||||
private double mob_thrower_speed = 4.0;
|
||||
private List<LivingEntity> mob_thrower_queue = new ArrayList<LivingEntity>();
|
||||
private int mp44_schedule_id = -1;
|
||||
private boolean mp44_armed = false;
|
||||
private boolean mp44_firing = false;
|
||||
|
||||
public TFM_UserInfo()
|
||||
private TFM_UserInfo(Player player)
|
||||
{
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public static TFM_UserInfo getPlayerData(Player p, TotalFreedomMod tfm)
|
||||
@ -40,7 +42,7 @@ public class TFM_UserInfo
|
||||
TFM_UserInfo playerdata = tfm.userinfo.get(p);
|
||||
if (playerdata == null)
|
||||
{
|
||||
playerdata = new TFM_UserInfo();
|
||||
playerdata = new TFM_UserInfo(p);
|
||||
tfm.userinfo.put(p, playerdata);
|
||||
}
|
||||
return playerdata;
|
||||
@ -273,9 +275,11 @@ public class TFM_UserInfo
|
||||
}
|
||||
}
|
||||
|
||||
public void startArrowShooter(int schedule_id)
|
||||
public void startArrowShooter(TotalFreedomMod plugin)
|
||||
{
|
||||
this.mp44_schedule_id = schedule_id;
|
||||
this.stopArrowShooter();
|
||||
this.mp44_schedule_id = Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, new ArrowShooter(this.player), 1L, 1L);
|
||||
mp44_firing = true;
|
||||
}
|
||||
|
||||
public void stopArrowShooter()
|
||||
@ -285,5 +289,46 @@ public class TFM_UserInfo
|
||||
Bukkit.getScheduler().cancelTask(this.mp44_schedule_id);
|
||||
this.mp44_schedule_id = -1;
|
||||
}
|
||||
mp44_firing = false;
|
||||
}
|
||||
|
||||
class ArrowShooter implements Runnable
|
||||
{
|
||||
private Player _player;
|
||||
|
||||
public ArrowShooter(Player player)
|
||||
{
|
||||
this._player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Arrow shot_arrow = _player.shootArrow();
|
||||
shot_arrow.setVelocity(shot_arrow.getVelocity().multiply(2.0));
|
||||
}
|
||||
}
|
||||
|
||||
public void armMP44()
|
||||
{
|
||||
mp44_armed = true;
|
||||
this.stopArrowShooter();
|
||||
}
|
||||
|
||||
public void disarmMP44()
|
||||
{
|
||||
mp44_armed = false;
|
||||
this.stopArrowShooter();
|
||||
}
|
||||
|
||||
public boolean isMP44Armed()
|
||||
{
|
||||
return this.mp44_armed;
|
||||
}
|
||||
|
||||
public boolean toggleMP44Firing()
|
||||
{
|
||||
this.mp44_firing = !this.mp44_firing;
|
||||
return this.mp44_firing;
|
||||
}
|
||||
}
|
||||
|
@ -23,10 +23,6 @@ public class TFM_Util
|
||||
{
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
public TFM_Util()
|
||||
{
|
||||
}
|
||||
|
||||
public static void tfm_broadcastMessage(String message, ChatColor color)
|
||||
{
|
||||
log.info(message);
|
||||
|
Loading…
Reference in New Issue
Block a user