mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-27 20:27:37 +00:00
Misc
This commit is contained in:
parent
8119ca553a
commit
e094c9c114
@ -14,7 +14,8 @@ auto_wipe: true
|
||||
|
||||
# Nuking prevention:
|
||||
nuke_monitor: true
|
||||
nuke_monitor_count: 100
|
||||
nuke_monitor_count_break: 100
|
||||
nuke_monitor_count_place: 25
|
||||
nuke_monitor_range: 10.0
|
||||
freecam_trigger_count: 10
|
||||
|
||||
|
@ -91,13 +91,13 @@ public class TFM_BlockListener extends BlockListener
|
||||
|
||||
if (plugin.nukeMonitor)
|
||||
{
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin);
|
||||
|
||||
Location player_pos = p.getLocation();
|
||||
Location block_pos = event.getBlock().getLocation();
|
||||
|
||||
if (player_pos.distance(block_pos) > plugin.nukeMonitorRange)
|
||||
{
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin);
|
||||
|
||||
playerdata.incrementFreecamPlaceCount();
|
||||
if (playerdata.getFreecamPlaceCount() > plugin.freecamTriggerCount)
|
||||
{
|
||||
@ -113,6 +113,20 @@ public class TFM_BlockListener extends BlockListener
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
playerdata.incrementBlockPlaceCount();
|
||||
if (playerdata.getBlockPlaceCount() > plugin.nukeMonitorCountPlace)
|
||||
{
|
||||
TFM_Util.tfm_broadcastMessage(p.getName() + " is placing blocks too fast!", ChatColor.RED);
|
||||
|
||||
p.setOp(false);
|
||||
p.setGameMode(GameMode.SURVIVAL);
|
||||
p.getInventory().clear();
|
||||
p.kickPlayer("You are placing blocks too fast.");
|
||||
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack is = new ItemStack(event.getBlockPlaced().getType(), 1, (short) 0, event.getBlockPlaced().getData());
|
||||
|
@ -1,7 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -21,6 +21,7 @@ public class TFM_Heartbeat implements Runnable
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin);
|
||||
playerdata.resetMsgCount();
|
||||
playerdata.resetBlockDestroyCount();
|
||||
playerdata.resetBlockPlaceCount();
|
||||
}
|
||||
|
||||
if (plugin.autoEntityWipe)
|
||||
|
@ -5,7 +5,6 @@ import java.util.regex.Pattern;
|
||||
import org.bukkit.ChatColor;
|
||||
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.event.block.Action;
|
||||
|
@ -14,6 +14,7 @@ public class TFM_UserInfo
|
||||
private boolean user_frozen = false;
|
||||
private int msg_count = 0;
|
||||
private int block_destroy_total = 0;
|
||||
private int block_place_total = 0;
|
||||
private int freecam_destroy_count = 0;
|
||||
private int freecam_place_count = 0;
|
||||
private boolean forced_death = false;
|
||||
@ -27,8 +28,8 @@ public class TFM_UserInfo
|
||||
private boolean mob_thrower_enabled = false;
|
||||
private CreatureType mob_thrower_creature = CreatureType.PIG;
|
||||
private double mob_thrower_speed = 4.0;
|
||||
private List<LivingEntity> mobqueue = new ArrayList<LivingEntity>();
|
||||
private int schedule_id = -1;
|
||||
private List<LivingEntity> mob_thrower_queue = new ArrayList<LivingEntity>();
|
||||
private int mp44_schedule_id = -1;
|
||||
|
||||
public TFM_UserInfo()
|
||||
{
|
||||
@ -186,6 +187,21 @@ public class TFM_UserInfo
|
||||
{
|
||||
this.block_destroy_total = 0;
|
||||
}
|
||||
|
||||
public void incrementBlockPlaceCount()
|
||||
{
|
||||
this.block_place_total++;
|
||||
}
|
||||
|
||||
public int getBlockPlaceCount()
|
||||
{
|
||||
return this.block_place_total;
|
||||
}
|
||||
|
||||
public void resetBlockPlaceCount()
|
||||
{
|
||||
this.block_place_total = 0;
|
||||
}
|
||||
|
||||
public void incrementFreecamDestroyCount()
|
||||
{
|
||||
@ -246,10 +262,10 @@ public class TFM_UserInfo
|
||||
|
||||
public void enqueueMob(LivingEntity mob)
|
||||
{
|
||||
mobqueue.add(mob);
|
||||
if (mobqueue.size() > 4)
|
||||
mob_thrower_queue.add(mob);
|
||||
if (mob_thrower_queue.size() > 4)
|
||||
{
|
||||
LivingEntity oldmob = mobqueue.remove(0);
|
||||
LivingEntity oldmob = mob_thrower_queue.remove(0);
|
||||
if (oldmob != null)
|
||||
{
|
||||
oldmob.damage(20);
|
||||
@ -259,15 +275,15 @@ public class TFM_UserInfo
|
||||
|
||||
void startArrowShooter(int schedule_id)
|
||||
{
|
||||
this.schedule_id = schedule_id;
|
||||
this.mp44_schedule_id = schedule_id;
|
||||
}
|
||||
|
||||
void stopArrowShooter()
|
||||
{
|
||||
if (this.schedule_id != -1)
|
||||
if (this.mp44_schedule_id != -1)
|
||||
{
|
||||
Bukkit.getScheduler().cancelTask(this.schedule_id);
|
||||
this.schedule_id = -1;
|
||||
Bukkit.getScheduler().cancelTask(this.mp44_schedule_id);
|
||||
this.mp44_schedule_id = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
public boolean autoEntityWipe = true;
|
||||
public boolean nukeMonitor = true;
|
||||
public int nukeMonitorCountBreak = 100;
|
||||
public int nukeMonitorCountPlace = 25;
|
||||
public double nukeMonitorRange = 10.0D;
|
||||
public int freecamTriggerCount = 10;
|
||||
public Boolean preprocessLogEnabled = true;
|
||||
@ -86,7 +87,8 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
explosiveRadius = config.getDouble("explosiveRadius", explosiveRadius);
|
||||
autoEntityWipe = config.getBoolean("auto_wipe", autoEntityWipe);
|
||||
nukeMonitor = config.getBoolean("nuke_monitor", nukeMonitor);
|
||||
nukeMonitorCountBreak = config.getInt("nuke_monitor_count", nukeMonitorCountBreak);
|
||||
nukeMonitorCountBreak = config.getInt("nuke_monitor_count_break", nukeMonitorCountBreak);
|
||||
nukeMonitorCountPlace = config.getInt("nuke_monitor_count_place", nukeMonitorCountPlace);
|
||||
nukeMonitorRange = config.getDouble("nuke_monitor_range", nukeMonitorRange);
|
||||
freecamTriggerCount = config.getInt("freecam_trigger_count", freecamTriggerCount);
|
||||
preprocessLogEnabled = config.getBoolean("preprocess_log", preprocessLogEnabled);
|
||||
|
Loading…
Reference in New Issue
Block a user