Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Cheese 2015-07-14 09:58:22 +10:00
commit 5797f6bc00
189 changed files with 575 additions and 15344 deletions

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core.CraftBukkit"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar" sourcepath="/REPO_DIR/GitHubLibraries/CraftBukkit/src"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.Core"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/bukkit.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS" value="Dominate,PvP,CaptureThePig,Tutorial,MineKart,"/>
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="Dominate,PvP,CaptureThePig,Tutorial,MineKart,"/>
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value=""/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${BUILD_FILES}/common.xml"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Core}"/>
</launchConfiguration>

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Core</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/CoreBuilder.launch</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -1,11 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

View File

@ -1,91 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
Any modifications will be overwritten.
To include a user specific buildfile here, simply create one in the same
directory with the processing instruction <?eclipse.ant.import?>
as the first entry and export the buildfile again. -->
<project basedir="." default="build" name="Core">
<property environment="env"/>
<property name="REPO_DIR" value="../../"/>
<property name="Game.location" value="../Base"/>
<property name="Nautilus.Game.CaptureThePig.location" value="../Nautilus.Game.CaptureThePig"/>
<property name="Nautilus.Game.Core.location" value="../Nautilus.Game.Core"/>
<property name="Nautilus.Game.Dominate.location" value="../Nautilus.Game.Dominate"/>
<property name="Nautilus.Game.Lobby.location" value="../Nautilus.Game.Lobby"/>
<property name="Nautilus.Game.PvP.location" value="../Nautilus.Game.PvP"/>
<property name="Nautilus.Game.Tutorial.location" value="../Nautilus.Game.Tutorial"/>
<property name="Nautilus.Main.location" value="../Nautilus.Main"/>
<property name="ECLIPSE_HOME" value="../../../../../Program Files/eclipse"/>
<property name="Nautilus.Core.location" value="../Nautilus.Core"/>
<property name="Nautilus.Core.CraftBukkit.location" value="../Nautilus.Core.CraftBukkit"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.6"/>
<property name="source" value="1.6"/>
<path id="Nautilus.Core.CraftBukkit.classpath">
<pathelement location="${Nautilus.Core.CraftBukkit.location}/bin"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/jline-2.6.jar"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/craftbukkit.jar"/>
</path>
<path id="Nautilus.Core.classpath">
<pathelement location="${Nautilus.Core.location}/bin"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/httpcore-4.2.jar"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/httpclient-4.2.jar"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/craftbukkit.jar"/>
</path>
<path id="Core.classpath">
<pathelement location="bin"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/bukkit.jar"/>
<path refid="Nautilus.Core.CraftBukkit.classpath"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/craftbukkit.jar"/>
<path refid="Nautilus.Core.classpath"/>
</path>
<target name="init">
<mkdir dir="bin"/>
<copy includeemptydirs="false" todir="bin">
<fileset dir="src">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="bin"/>
</target>
<target depends="clean" name="cleanall">
<ant antfile="Nautilus.Core.xml" dir="${Nautilus.Core.location}" inheritAll="false" target="clean"/>
<ant antfile="Nautilus.Core.CraftBukkit.xml" dir="${Nautilus.Core.CraftBukkit.location}" inheritAll="false" target="clean"/>
</target>
<target depends="build-subprojects,build-project" name="build"/>
<target name="build-subprojects">
<ant antfile="Nautilus.Core.xml" dir="${Nautilus.Core.location}" inheritAll="false" target="build-project">
<propertyset>
<propertyref name="build.compiler"/>
</propertyset>
</ant>
<ant antfile="Nautilus.Core.CraftBukkit.xml" dir="${Nautilus.Core.CraftBukkit.location}" inheritAll="false" target="build-project">
<propertyset>
<propertyref name="build.compiler"/>
</propertyset>
</ant>
</target>
<target depends="init" name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
<src path="src"/>
<classpath refid="Core.classpath"/>
</javac>
</target>
<target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
<copy todir="${ant.library.dir}">
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</copy>
<unzip dest="${ant.library.dir}">
<patternset includes="jdtCompilerAdapter.jar"/>
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</unzip>
</target>
<target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<antcall target="build"/>
</target>
</project>

View File

@ -1,186 +0,0 @@
package me.chiss.Core.ClientData;
import java.util.HashMap;
import nautilus.minecraft.core.webserver.token.Account.ClientClanToken;
import me.chiss.Core.Clans.ClansUtility.ClanRelation;
import mineplex.core.account.CoreClient;
import mineplex.core.server.IRepository;
public class ClientClan extends ClientDataBase<ClientClanToken>
{
//Data
private String _clanName = "";
private String _inviter = "";
private long _delay = 0;
//Temp - Territory
private boolean _safe = false;
private boolean _mapOn = false;
private String _territory = "";
private String _owner = "";
private boolean _clanChat = false;
private boolean _allyChat = false;
//Colors
private HashMap<String, ClanRelation> _relations = new HashMap<String, ClanRelation>();
//Admin
private String mimic = "";
private boolean autoClaim = false;
public ClientClan(CoreClient client, IRepository repository)
{
super(client, "Clan", repository);
}
@Override
public void Load()
{
//Load Clients
}
@Override
public void LoadToken(ClientClanToken token)
{
if (token != null)
{
_clanName = token.Name;
}
}
public void Update(String clanName, String inviter, long delay)
{
_clanName = clanName;
_inviter = inviter;
_delay = delay;
}
public boolean CanJoin()
{
if (System.currentTimeMillis() > _delay)
return true;
return false;
}
public boolean InClan()
{
return (!_clanName.equals(""));
}
public void Reset()
{
_clanName = "";
_inviter = "";
}
public String GetClanName() {
return _clanName;
}
public void SetClan(String _clanName) {
this._clanName = _clanName;
}
public String GetInviter() {
return _inviter;
}
public void SetInviter(String _inviter) {
this._inviter = _inviter;
}
public long GetDelay() {
return _delay;
}
public void SetDelay(long _delay) {
this._delay = _delay;
}
public boolean IsSafe() {
return _safe;
}
public void SetSafe(boolean _safe) {
this._safe = _safe;
}
public boolean IsMapOn() {
return _mapOn;
}
public void SetMapOn(boolean _mapOn) {
this._mapOn = _mapOn;
}
public String GetTerritory() {
return _territory;
}
public void SetTerritory(String _territory) {
this._territory = _territory;
}
public String GetOwner() {
return _owner;
}
public void SetOwner(String _owner) {
this._owner = _owner;
}
public boolean IsClanChat() {
return _clanChat;
}
public void SetClanChat(boolean enabled)
{
this._clanChat = enabled;
if (enabled)
_allyChat = false;
}
public boolean IsAllyChat() {
return _allyChat;
}
public void SetAllyChat(boolean enabled)
{
this._allyChat = enabled;
if (enabled)
_clanChat = false;
}
public String GetMimic() {
return mimic;
}
public void SetMimic(String mimic) {
this.mimic = mimic;
}
public boolean IsAutoClaim()
{
return autoClaim;
}
public void SetAutoClaim(boolean claim) {
this.autoClaim = claim;
}
public void SetRelationship(String player, ClanRelation relation)
{
_relations.put(player, relation);
}
public ClanRelation GetRelation(String player)
{
return _relations.get(player);
}
}

View File

@ -1,42 +0,0 @@
package me.chiss.Core.ClientData;
import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager;
import mineplex.core.server.IRepository;
public abstract class ClientDataBase<TokenType> implements IClientDataLoad
{
protected CoreClient Client;
protected String DataName;
protected IRepository Repository;
public ClientDataBase(CoreClient client, String dataName, IRepository repository)
{
Client = client;
DataName = dataName;
Repository = repository;
Load();
}
public ClientDataBase(CoreClient client, String dataName, IRepository repository, TokenType token)
{
Client = client;
DataName = dataName;
Repository = repository;
LoadToken(token);
}
public String GetDataName()
{
return DataName;
}
protected abstract void LoadToken(TokenType token);
public CoreClientManager Manager()
{
return Client.Manager();
}
}

View File

@ -1,182 +0,0 @@
package me.chiss.Core.ClientData;
import mineplex.core.account.CoreClient;
public class ClientNAC extends ClientDataBase<Object>
{
//XXX - Temp
private long _requireTime = 86400000;
//Loaded at Plugin Load
private boolean _required = false;
private String _date = "";
private String _admin = "";
private String _reason = "";
//Loaded on Client Connect
private boolean _using = false;
private long _queryTime = 0;
private String _token = "";
private String _pack = "";
private String _packHash = "";
public ClientNAC(CoreClient client)
{
super(client, "CAH", null);
}
@Override
public void Load()
{
//Load Requirements
}
@Override
public void LoadToken(Object token)
{
}
public void SetRequired(boolean required)
{
_required = required;
}
public boolean GetRequired()
{
return _required;
}
public long GetRequireTime()
{
return _requireTime;
}
public boolean IsRequired()
{
if (_required)
return true;
if (Client.Acc().GetPlayTime() > _requireTime)
return true;
return false;
}
public void SetUsing(boolean using)
{
_using = using;
}
public boolean IsUsing()
{
return _using;
}
public void Reset()
{
_using = false;
_queryTime = 0;
_token = "";
_pack = "";
_packHash = "";
}
public void SetQueryTime(long time)
{
_queryTime = time;
}
public long GetQueryTime()
{
return _queryTime;
}
public String GetPack()
{
return _pack;
}
public void SetPack(String pack)
{
_pack = pack;
}
public String GetPackHash()
{
return _packHash;
}
public void SetPackHash(String packHash)
{
_packHash = packHash;
}
public boolean HasToken()
{
return _token.length() > 0;
}
public String GetToken()
{
return _token;
}
public void SetToken(String token)
{
_token = token;
}
public void SetDate(String date)
{
_date = date;
}
public String GetDate()
{
return _date;
}
public void SetAdmin(String admin)
{
_admin = admin;
}
public String GetAdmin()
{
return _admin;
}
public void SetReason(String reason)
{
_reason = reason;
}
public String GetReason()
{
return _reason;
}
public void Save()
{
if (!_required)
return;
/*
String statement = "REPLACE INTO client_cah (client, date, admin, reason, systime) VALUES (" +
Client.Manager().SQL().f(Client.GetPlayerName()) + ", " +
Client.Manager().SQL().f(_date) + ", " +
Client.Manager().SQL().f(_admin) + ", " +
Client.Manager().SQL().f(_reason) + ", " +
System.currentTimeMillis() + ")";
//Insert
Client.Manager().SQL().doStatement(statement, DB.REMOTE, true);*/
}
}

View File

@ -1,54 +0,0 @@
package me.chiss.Core.ClientData;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map.Entry;
import me.chiss.Core.Class.IPvpClass;
import me.chiss.Core.Skill.ISkill;
import me.chiss.Core.Skill.ISkill.SkillType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
public interface IClientClass
{
String GetName();
void SetGameClass(IPvpClass gameClass);
void SetGameClass(IPvpClass gameClass, boolean addDefaultSkills);
IPvpClass GetGameClass();
void AddSkill(ISkill skill, int level);
void RemoveSkill(ISkill getSkill);
Collection<Entry<ISkill, Integer>> GetSkills();
Collection<Entry<ISkill, Integer>> GetDefaultSkills();
ISkill GetSkillByType(SkillType skillType);
void ResetSkills();
void ClearSkills();
void ClearDefaultSkills();
int GetSkillLevel(ISkill skill);
PlayerInventory GetInventory();
void OpenInventory(Inventory skillsCategory);
void CloseInventory();
void UpdateInventory();
void ClearDefaults();
void AddDefaultArmor(ItemStack[] armorContents);
void PutDefaultItem(ItemStack deliverable, int slot);
HashMap<Integer, ItemStack> GetDefaultItems();
ItemStack[] GetDefaultArmor();
void SetDefaultHead(ItemStack armor);
void SetDefaultChest(ItemStack armor);
void SetDefaultLegs(ItemStack armor);
void SetDefaultFeet(ItemStack armor);
void ResetToDefaults(boolean equipItems, boolean equipDefaultArmor);
}

View File

@ -1,227 +0,0 @@
package me.chiss.Core.Config;
import java.util.HashMap;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import me.chiss.Core.Module.AModule;
public class Config extends AModule
{
public Config(JavaPlugin plugin)
{
super("Config", plugin);
}
//Configuation
private HashMap<String, HashMap<String, String>> _moduleConfig = new HashMap<String, HashMap<String, String>>();
@Override
public void enable()
{
_moduleConfig.clear();
/*
ResultSet rs = _sql.doQuery("SELECT module,variable,value FROM config", DB.LOCAL);
try
{
while (rs.next())
{
String module = rs.getString(1);
String variable = rs.getString(2);
String value = rs.getString(3);
//Ensure Module Exists
if (!_moduleConfig.containsKey(module))
_moduleConfig.put(module, new HashMap<String, String>());
//Add Variable
_moduleConfig.get(module).put(variable, value);
}
Log("Configuration Loaded from SQL");
}
catch (Exception e)
{
Log(DB.LOCAL + " SQL Error: " + e.getMessage());
Log("SELECT module,variable,value FROM config");
}*/
}
@Override
public void disable()
{
long epoch = System.currentTimeMillis();
Log("Saving Config...");
//writeVars();
Log("Config Saved. Took " + (System.currentTimeMillis()-epoch) + " milliseconds.");
}
@Override
public void config()
{
}
@Override
public void commands()
{
}
@Override
public void command(Player caller, String cmd, String[] args)
{
}
public void writeVars()
{
/*
//Clear
_sql.doStatement("DELETE FROM config", DB.LOCAL, false);
//Write
for (String curModule : _moduleConfig.keySet())
{
for (String curVariable : _moduleConfig.get(curModule).keySet())
{
writeVar(curModule, curVariable, _moduleConfig.get(curModule).get(curVariable));
}
}*/
}
public void writeVar(String module, String variable, String value)
{/*
String statement = "REPLACE INTO config (module,variable,value) VALUES (" +
_sql.f(module) + ", " +
_sql.f(variable) + ", " +
_sql.f(value) + ")";
//Insert
_sql.doStatement(statement, DB.LOCAL, true);
*/}
public void addVar(String module, String variable, String value)
{
Log("Adding Variable [" + module + ": " + variable + " = " + value + "]");
//Ensure Module Exists
if (!_moduleConfig.containsKey(module))
_moduleConfig.put(module, new HashMap<String, String>());
//Add Variable
_moduleConfig.get(module).put(variable, value);
writeVar(module, variable, value);
}
public String getString(String module, String variable, String def)
{
if (!_moduleConfig.containsKey(module))
{
Log("Variable Not Found [" + module + ": " + variable + "]");
addVar(module, variable, def);
return def;
}
HashMap<String, String> varMap = _moduleConfig.get(module);
if (!varMap.containsKey(variable))
{
Log("Variable Not Found [" + module + ": " + variable + "]");
addVar(module, variable, def);
return def;
}
return varMap.get(variable);
}
public int getInt(String module, String variable, int def)
{
if (!_moduleConfig.containsKey(module))
{
Log("Variable Not Found [" + module + ": " + variable + "]");
addVar(module, variable, def+"");
return def;
}
HashMap<String, String> varMap = _moduleConfig.get(module);
if (!varMap.containsKey(variable))
{
Log("Variable Not Found [" + module + ": " + variable + "]");
addVar(module, variable, def+"");
return def;
}
try
{
return Integer.parseInt(varMap.get(variable));
}
catch (Exception e)
{
return 0;
}
}
public long getLong(String module, String variable, long def)
{
if (!_moduleConfig.containsKey(module))
{
Log("Variable Not Found [" + module + ": " + variable + "]");
addVar(module, variable, def+"");
return def;
}
HashMap<String, String> varMap = _moduleConfig.get(module);
if (!varMap.containsKey(variable))
{
Log("Variable Not Found [" + module + ": " + variable + "]");
addVar(module, variable, def+"");
return def;
}
try
{
return Long.parseLong(varMap.get(variable));
}
catch (Exception e)
{
return 0;
}
}
public boolean getBool(String module, String variable, boolean def)
{
if (!_moduleConfig.containsKey(module))
{
Log("Variable Not Found [" + module + ": " + variable + "]");
addVar(module, variable, def+"");
return def;
}
HashMap<String, String> varMap = _moduleConfig.get(module);
if (!varMap.containsKey(variable))
{
Log("Variable Not Found [" + module + ": " + variable + "]");
addVar(module, variable, def+"");
return def;
}
try
{
return Boolean.parseBoolean(varMap.get(variable));
}
catch (Exception e)
{
addVar(module, variable, def+"");
return def;
}
}
}

View File

@ -1,26 +0,0 @@
package me.chiss.Core.Delayed;
import org.bukkit.entity.Player;
import me.chiss.Core.Frame.ADelay;
import me.chiss.Core.NAC.NACTask;
public class delayNACQuery extends ADelay
{
private NACTask _task;
public delayNACQuery(Player player, String data, NACTask task)
{
super(player, data);
_task = task;
}
@Override
public void delayed()
{
if (player == null)
return;
_task.sendQuery(player, false);
}
}

View File

@ -1,33 +0,0 @@
package me.chiss.Core.Events;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class ServerSaveEvent extends Event implements Cancellable
{
private static final HandlerList handlers = new HandlerList();
private boolean _cancelled = false;
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public boolean isCancelled()
{
return _cancelled;
}
@Override
public void setCancelled(boolean cancel)
{
_cancelled = cancel;
}
}

View File

@ -1,23 +0,0 @@
package me.chiss.Core.Frame;
import org.bukkit.entity.Player;
public abstract class ADelay implements Runnable
{
public Player player;
public String data;
public ADelay(Player player, String data)
{
this.player = player;
this.data = data;
}
@Override
public void run()
{
delayed();
}
public abstract void delayed();
}

View File

@ -1,209 +0,0 @@
package me.chiss.Core.Loot;
import java.util.HashSet;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import me.chiss.Core.Loot.LootFactory;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.itemstack.ItemStackFactory;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
public abstract class LootBase implements Listener
{
protected LootFactory Factory;
private String _name;
private String[] _lore;
private Material _mat;
private ActionType _trigger;
private int _enchLevel;
private HashSet<Player> _users;
public LootBase(LootFactory factory, String name, String[] lore, Material mat, ActionType trigger, int level)
{
Factory = factory;
_name = name;
_lore = lore;
_mat = mat;
_trigger = trigger;
_enchLevel = level;
_users = new HashSet<Player>();
}
@EventHandler
public void EquipHeld(PlayerItemHeldEvent event)
{
ItemStack newSlot = event.getPlayer().getInventory().getItem(event.getNewSlot());
if (!_users.contains(event.getPlayer()))
Equip(event.getPlayer(), newSlot);
}
@EventHandler
public void EquipPickup(PlayerPickupItemEvent event)
{
if (event.isCancelled())
return;
Equip(event.getPlayer(), event.getPlayer().getItemInHand());
}
@EventHandler
public void EquipInventory(InventoryCloseEvent event)
{
if (event.getPlayer() instanceof Player)
Equip((Player) event.getPlayer(), event.getPlayer().getItemInHand());
}
@EventHandler
public void EquipJoin(PlayerJoinEvent event)
{
Equip(event.getPlayer(), event.getPlayer().getItemInHand());
}
public void Equip(Player ent, ItemStack item)
{
if (_users.contains(ent))
return;
if (!UtilGear.isMat(item, _mat))
return;
if (!CraftItemStack.asNMSCopy(item).getName().contains(_name))
return;
_users.add(ent);
}
@EventHandler
public void UpdateUnequip(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
HashSet<Entity> remove = new HashSet<Entity>();
for (Entity cur : _users)
{
if (!(cur instanceof Player))
continue;
if (Unequip((Player)cur))
remove.add(cur);
}
for (Entity cur : remove)
_users.remove(cur);
}
public boolean Unequip(Player player)
{
if (!UtilGear.isMat(player.getItemInHand(), _mat))
return true;
if (!CraftItemStack.asNMSCopy(player.getItemInHand()).getName().contains(_name))
return true;
return false;
}
@EventHandler
public void DamageTrigger(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
return;
Player damager = event.GetDamagerPlayer(false);
if (damager == null) return;
if (!_users.contains(damager))
return;
Damage(event);
}
public abstract void Damage(CustomDamageEvent event);
@EventHandler
public void AbilityTrigger(PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, _trigger))
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (Unequip(event.getPlayer()))
return;
if (!_users.contains(event.getPlayer()))
return;
Ability(event);
}
public abstract void Ability(PlayerInteractEvent event);
public String GetName()
{
return _name;
}
public Material GetMaterial()
{
return _mat;
}
public HashSet<Player> GetUsers()
{
return _users;
}
public void GiveTo(Player caller)
{
caller.getInventory().addItem(Get());
}
public ItemStack Get()
{
ItemStack loot = ItemStackFactory.Instance.CreateStack(_mat.getId(), (byte)0, 1, "§r" + ChatColor.RESET + C.mLoot +_name, _lore);
loot.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, _enchLevel);
return loot;
}
public void Reset(Player player)
{
_users.remove(player);
ResetCustom(player);
}
public abstract void ResetCustom(Player player);
}

View File

@ -1,170 +0,0 @@
package me.chiss.Core.Loot;
import java.util.ArrayList;
import java.util.HashMap;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import me.chiss.Core.Loot.Weapons.AlligatorsTooth;
import me.chiss.Core.Loot.Weapons.GiantsSword;
import me.chiss.Core.Loot.Weapons.HyperAxe;
import me.chiss.Core.Loot.Weapons.LightningScythe;
import me.chiss.Core.Loot.Weapons.MagneticBlade;
import me.chiss.Core.Loot.Weapons.MeteorBow;
import me.chiss.Core.Loot.Weapons.WindBlade;
import me.chiss.Core.Module.AModule;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.itemstack.ItemStackFactory;
public class LootFactory extends AModule
{
private ArrayList<LootBase> _legendary;
private HashMap<Item, LootBase> _loot = new HashMap<Item, LootBase>();
public LootFactory(JavaPlugin plugin)
{
super("Loot Factory", plugin);
}
@Override
public void enable()
{
_legendary = new ArrayList<LootBase>();
AddLoot(new WindBlade(this));
AddLoot(new LightningScythe(this));
AddLoot(new HyperAxe(this));
AddLoot(new GiantsSword(this));
AddLoot(new MeteorBow(this));
AddLoot(new AlligatorsTooth(this));
AddLoot(new MagneticBlade(this));
}
@Override
public void disable()
{
}
@Override
public void config()
{
}
@Override
public void commands()
{
AddCommand("giveloot");
}
@Override
public void command(Player caller, String cmd, String[] args)
{
if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true))
return;
for (LootBase loot : _legendary)
loot.GiveTo(caller);
}
@EventHandler
public void Interact(PlayerInteractEvent event)
{
if (event.getPlayer().getItemInHand() == null)
return;
if (!Clients().Get(event.getPlayer()).Rank().Has(Rank.ADMIN, false))
return;
if (event.getPlayer().getItemInHand().getType() != Material.BLAZE_POWDER)
return;
DropLoot(event.getPlayer().getTargetBlock(null, 0).getRelative(BlockFace.UP).getLocation().add(0.5, 0.5, 0.5), 2, 3, 0.05f, 0.01f, 2d);
event.setCancelled(true);
}
private void AddLoot(LootBase loot)
{
_legendary.add(loot);
//Register Events
UtilServer.getServer().getPluginManager().registerEvents(loot, Plugin());
}
@EventHandler
public void Quit(PlayerQuitEvent event)
{
for (LootBase loot : _legendary)
loot.Reset(event.getPlayer());
}
public void DropLoot(Location loc, int eMin, int eRan, float rareChance, float legendChance, double forceMult)
{
//Emerald
DropEmerald(loc, eMin, eRan, forceMult);
//Enchantment
if (Math.random() < rareChance)
DropRare(loc, forceMult);
//Weapon
if (Math.random() < legendChance)
DropLegendary(loc, forceMult);
}
public void DropEmerald(Location loc, int eMin, int eRan, double forceMult)
{
for (int i=0 ; i < eMin + UtilMath.r(eRan+1) ; i++)
{
Item e = loc.getWorld().dropItemNaturally(loc, ItemStackFactory.Instance.CreateStack(Material.EMERALD));
e.setVelocity(e.getVelocity().multiply(forceMult));
}
}
public void DropRare(Location loc, double forceMult)
{
}
public void DropLegendary(Location loc, double forceMult)
{
LootBase loot = _legendary.get(UtilMath.r(_legendary.size()));
Item e = loc.getWorld().dropItemNaturally(loc, loot.Get());
e.setVelocity(e.getVelocity().multiply(forceMult));
_loot.put(e, loot);
}
@EventHandler
public void Pickup(PlayerPickupItemEvent event)
{
if (event.isCancelled())
return;
if (!_loot.containsKey(event.getItem()))
return;
LootBase loot = _loot.remove(event.getItem());
UtilServer.broadcastSpecial("Legendary Loot",
F.name(event.getPlayer().getName()) + " looted " + F.item(C.cRed + loot.GetName()) + " near " +
F.elem(UtilWorld.locToStrClean(event.getPlayer().getLocation())));
}
}

View File

@ -1,123 +0,0 @@
package me.chiss.Core.Loot.Weapons;
import java.util.HashSet;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import me.chiss.Core.Loot.LootBase;
import me.chiss.Core.Loot.LootFactory;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType;
public class AlligatorsTooth extends LootBase
{
private HashSet<Player> _active = new HashSet<Player>();
public AlligatorsTooth(LootFactory factory)
{
super(factory, "Alligators Tooth", new String[]
{
"",
C.cGray + "Damage: " + C.cYellow + "7 + 2 in Water",
C.cGray + "Ability: " + C.cYellow + "Alliagtor Rush",
C.cGray + "Passive: " + C.cYellow + "Water Breathing",
C.cGray + "Knockback: " + C.cYellow + "100%",
"",
C.cWhite + "A blade forged from hundreds of",
C.cWhite + "alligators teeth. It's powers allow ",
C.cWhite + "its owner to swim with great speed,",
C.cWhite + "able to catch any prey.",
""
},
Material.IRON_SWORD, ActionType.R, 1);
}
@Override
public void Damage(CustomDamageEvent event)
{
event.AddMod("Negate", GetName(), -event.GetDamageInitial(), false);
//Base Damage
event.AddMod(event.GetDamagerPlayer(false).getName(), C.mLoot + GetName(), 7, true);
if (event.GetDamageeEntity().getLocation().getBlock().isLiquid())
{
event.AddMod(event.GetDamagerPlayer(false).getName(), C.mLoot + "Water Bonus", 2, false);
event.AddKnockback(GetName(), 0.5);
}
}
@Override
public void Ability(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (!player.getLocation().getBlock().isLiquid())
{
UtilPlayer.message(player, F.main(GetName(), "You cannot use " + F.skill("Alligator Rush") + " out of water."));
return;
}
if (!Factory.Energy().Use(player, "Alligator Rush", 10, true, true))
return;
_active.add(player);
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() == UpdateType.TICK)
for (Player cur : GetUsers())
{
if (!_active.contains(cur))
continue;
if (!cur.isBlocking())
{
_active.remove(cur);
continue;
}
if (!cur.getLocation().getBlock().isLiquid())
continue;
if (!Factory.Energy().Use(cur, "Alligator Rush", 1, true, true))
{
_active.remove(cur);
continue;
}
UtilAction.velocity(cur, 0.6, 0.1, 1, true);
//Effect
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, 8);
if (!cur.getEyeLocation().getBlock().isLiquid())
cur.getWorld().playSound(cur.getEyeLocation(), Sound.SPLASH, 0.25f, 1f);
cur.getWorld().playSound(cur.getLocation(), Sound.SPLASH, 0.25f, 1f);
}
if (event.getType() == UpdateType.FAST)
for (Player cur : GetUsers())
Factory.Condition().Factory().Breath(GetName(), cur, cur, 1.9, 0, false, false);
}
@Override
public void ResetCustom(Player player)
{
_active.remove(player);
}
}

View File

@ -1,73 +0,0 @@
package me.chiss.Core.Loot.Weapons;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import me.chiss.Core.Loot.LootBase;
import me.chiss.Core.Loot.LootFactory;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType;
public class GiantsSword extends LootBase
{
public GiantsSword(LootFactory factory)
{
super(factory, "Giants Broadsword", new String[]
{
"",
C.cGray + "Damage: " + C.cYellow + "10",
C.cGray + "Ability: " + C.cYellow + "Giant Recovery",
C.cGray + "Knockback: " + C.cYellow + "100%",
"",
C.cWhite + "Forged by the ancient giants. It's blade",
C.cWhite + "deals more damage than any other weapon.",
C.cWhite + "Upon blocking, it protects its owner.",
""
},
Material.IRON_SWORD, ActionType.R, 3);
}
@Override
public void Damage(CustomDamageEvent event)
{
event.AddMod("Negate", GetName(), -event.GetDamageInitial(), false);
//Base Damage
event.AddMod(event.GetDamagerPlayer(false).getName(), C.mLoot + GetName(), 10, true);
}
@Override
public void Ability(PlayerInteractEvent event)
{
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player cur : GetUsers())
{
if (!cur.isBlocking())
continue;
UtilPlayer.health(cur, 1);
Factory.Condition().Factory().Regen(GetName(), cur, cur, 0.9, 1, false, true);
Factory.Condition().Factory().Protection(GetName(), cur, cur, 0.9, 1, false, true);
}
}
@Override
public void ResetCustom(Player player)
{
}
}

View File

@ -1,147 +0,0 @@
package me.chiss.Core.Loot.Weapons;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.potion.PotionEffectType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import me.chiss.Core.Loot.LootBase;
import me.chiss.Core.Loot.LootFactory;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilEvent.ActionType;
public class HyperAxe extends LootBase
{
private HashMap<Player, Long> _rate = new HashMap<Player, Long>();
public HyperAxe(LootFactory factory)
{
super(factory, "Hyper Axe", new String[]
{
"",
C.cGray + "Damage: " + C.cYellow + "3",
C.cGray + "Ability: " + C.cYellow + "Hyper Speed",
C.cGray + "Passive: " + C.cYellow + "Hyper Attack",
C.cGray + "Knockback: " + C.cYellow + "25%",
"",
C.cWhite + "Rumoured to attack foes 500% faster",
C.cWhite + "than any other weapon known to man.",
""
},
Material.IRON_AXE, ActionType.R, 1);
}
@Override
public void Damage(CustomDamageEvent event)
{
}
@EventHandler (priority = EventPriority.LOWEST)
public void Rate(CustomDamageEvent event)
{
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
return;
Player damager = event.GetDamagerPlayer(false);
if (damager == null) return;
if (!GetUsers().contains(damager))
return;
if (!damager.hasPotionEffect(PotionEffectType.FAST_DIGGING))
return;
//Rate
if (_rate.containsKey(damager))
if (!UtilTime.elapsed(_rate.get(damager), 80))
{
event.SetCancelled("Damage Rate");
return;
}
_rate.put(damager, System.currentTimeMillis());
event.SetIgnoreRate(true);
event.SetCancelled(GetName());
}
@EventHandler (priority = EventPriority.HIGHEST)
public void DoDamage(CustomDamageEvent event)
{
if (!event.IsCancelled())
return;
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
return;
Player damager = event.GetDamagerPlayer(false);
if (damager == null) return;
if (!GetUsers().contains(damager))
return;
if (!event.GetCancellers().remove(GetName()))
return;
if (event.IsCancelled())
return;
//Negate
event.AddMod("Negate", GetName(), -event.GetDamageInitial(), false);
//Damage
event.AddMod(damager.getName(), C.mLoot + GetName(), 3, true);
event.AddKnockback(GetName(), 0.25);
damager.getWorld().playSound(damager.getLocation(), Sound.NOTE_PLING, 0.5f, 2f);
}
@Override
public void Ability(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (!Factory.Energy().Use(player, GetName(), 40, false, true))
return;
if (!Recharge.Instance.use(player, GetName(), 18000, true))
return;
if (!Factory.Energy().Use(player, GetName(), 40, true, true))
return;
//Inform
UtilPlayer.message(player, F.main(GetName(), "You used " + F.skill("Hyper Speed") + "."));
//Add
Factory.Condition().Factory().Speed(GetName(), player, player, 8, 3, false, true);
}
@EventHandler
public void SwingSpeed(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player cur : GetUsers())
Factory.Condition().Factory().DigFast(GetName(), cur, cur, 1.9, 1, false, false);
}
@Override
public void ResetCustom(Player player)
{
_rate.remove(player);
}
}

View File

@ -1,115 +0,0 @@
package me.chiss.Core.Loot.Weapons;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import me.chiss.Core.Loot.LootBase;
import me.chiss.Core.Loot.LootFactory;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType;
public class LightningScythe extends LootBase
{
public LightningScythe(LootFactory factory)
{
super(factory, "Lightning Scythe", new String[]
{
"",
C.cGray + "Damage: " + C.cYellow + "7",
C.cGray + "Ability: " + C.cYellow + "Lightning Strike",
C.cGray + "Passive: " + C.cYellow + "Lightning Speed",
C.cGray + "Passive: " + C.cYellow + "Electric Shock",
C.cGray + "Knockback: " + C.cYellow + "100%",
"",
C.cWhite + "An old scythe that is infused with the",
C.cWhite + "powers of the skies, able to strike ",
C.cWhite + "lightning at the owners command.",
""
},
Material.IRON_HOE, ActionType.R, 2);
}
@Override
public void Damage(CustomDamageEvent event)
{
event.AddMod("Negate", GetName(), -event.GetDamageInitial(), false);
//Base Damage
event.AddMod(event.GetDamagerPlayer(false).getName(), C.mLoot + GetName(), 7, true);
//Double Knockback
event.SetKnockback(false);
//Effect
Factory.Condition().Factory().Shock(GetName(), event.GetDamageeEntity(), event.GetDamagerPlayer(false), 2, false, false);
}
@Override
public void Ability(PlayerInteractEvent event)
{
Player player = event.getPlayer();
Block target = event.getPlayer().getTargetBlock(null, 0);
if (target == null)
return;
if (UtilMath.offset(target.getLocation(), player.getLocation()) > 24)
{
UtilPlayer.message(player, F.main(GetName(), "Target is out of range."));
return;
}
if (!Factory.Energy().Use(player, "Lightning Strike", 20, false, true))
return;
if (!Recharge.Instance.use(player, "Lightning Strike", 8000, true))
return;
if (!Factory.Energy().Use(player, "Lightning Strike", 20, true, true))
return;
//Durability
player.getItemInHand().setDurability((short) (player.getItemInHand().getDurability() + 6));
if (player.getItemInHand().getDurability() > 251)
player.setItemInHand(null);
UtilInv.Update(player);
//Condition
for (Player cur : UtilPlayer.getNearby(target.getLocation(), 8))
Factory.Condition().Factory().Lightning("Lightning Strike", cur, player, 0, 1, false, true);
//Strike
target.getWorld().strikeLightning(target.getLocation());
UtilPlayer.message(player, F.main(GetName(), "You used " + F.skill("Lightning Strike") + "."));
event.setCancelled(true);
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player cur : GetUsers())
Factory.Condition().Factory().Speed(GetName(), cur, cur, 1.9, 0, false, true);
}
@Override
public void ResetCustom(Player player)
{
}
}

View File

@ -1,150 +0,0 @@
package me.chiss.Core.Loot.Weapons;
import java.util.HashSet;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import me.chiss.Core.Loot.LootBase;
import me.chiss.Core.Loot.LootFactory;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType;
public class MagneticBlade extends LootBase
{
private HashSet<Player> _active = new HashSet<Player>();
public MagneticBlade(LootFactory factory)
{
super(factory, "Magnetic Blade", new String[]
{
"",
C.cGray + "Damage: " + C.cYellow + "7",
C.cGray + "Ability: " + C.cYellow + "Magnetic Pull",
C.cGray + "Knockback: " + C.cYellow + "Negative 40%",
"",
C.cWhite + "The Magnetic Blade is said to be able",
C.cWhite + "to pull nearby objects towards itself",
C.cWhite + "with unstoppable force.",
""
},
Material.IRON_SWORD, ActionType.R, 2);
}
@Override
public void Damage(CustomDamageEvent event)
{
event.AddMod("Negate", GetName(), -event.GetDamageInitial(), false);
//Base Damage
event.AddMod(event.GetDamagerPlayer(false).getName(), C.mLoot + GetName(), 7, true);
//Reverse Knockback
event.AddKnockback(GetName(), -0.4);
}
@Override
public void Ability(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (player.getLocation().getBlock().isLiquid())
{
UtilPlayer.message(player, F.main(GetName(), "You cannot use " + F.skill(GetName()) + " in water."));
return;
}
if (!Factory.Energy().Use(player, GetName(), 10, true, true))
return;
_active.add(player);
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : GetUsers())
{
if (!_active.contains(cur))
continue;
if (!cur.isBlocking())
{
_active.remove(cur);
continue;
}
if (cur.getLocation().getBlock().isLiquid())
continue;
//Target
Block target = cur.getTargetBlock(null, 0);
if (target == null)
continue;
if (UtilMath.offset(target.getLocation(), cur.getLocation()) > 16)
continue;
//Energy
if (!Factory.Energy().Use(cur, GetName(), 1, true, true))
{
_active.remove(cur);
continue;
}
//Effect
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, 42);
//Pull
for (Player other : cur.getWorld().getEntitiesByClass(Player.class))
{
//Other to Block
if (UtilMath.offset(target.getLocation(), other.getLocation()) > 3)
continue;
//Other to Cur
if (UtilMath.offset(cur, other) < 2)
continue;
if (!Factory.Relation().CanHurt(cur, other))
continue;
UtilAction.velocity(other, UtilAlg.getTrajectory(other, cur),
0.3, false, 0, 0, 1, true);
}
for (Entity other : cur.getWorld().getEntitiesByClass(org.bukkit.entity.Item.class))
{
//Other to Block
if (UtilMath.offset(target.getLocation(), other.getLocation()) > 3)
continue;
UtilAction.velocity(other, UtilAlg.getTrajectory(other.getLocation(), cur.getEyeLocation()),
0.3, false, 0, 0, 1, true);
}
}
}
@Override
public void ResetCustom(Player player)
{
_active.remove(player);
}
}

View File

@ -1,128 +0,0 @@
package me.chiss.Core.Loot.Weapons;
import java.util.HashSet;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import me.chiss.Core.Loot.LootBase;
import me.chiss.Core.Loot.LootFactory;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType;
public class MeteorBow extends LootBase
{
private HashSet<Entity> _arrows = new HashSet<Entity>();
public MeteorBow(LootFactory factory)
{
super(factory, "Meteor Bow", new String[]
{
"",
C.cGray + "Damage: " + C.cYellow + "10 (AoE)",
C.cGray + "Passive: " + C.cYellow + "Explosive Arrows",
"",
C.cWhite + "The mythical bow that reigned down",
C.cWhite + "hell from the heavens. Each shot",
C.cWhite + "is as deadly as a meteor.",
""
},
Material.BOW, ActionType.L, 2);
}
@Override
@EventHandler
public void DamageTrigger(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
Projectile proj = event.GetProjectile();
if (proj == null) return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
if (!GetUsers().contains(damager))
return;
event.SetCancelled("Meteor Shot");
}
@Override
public void Damage(CustomDamageEvent event)
{
}
@EventHandler
public void ProjectileShoot(EntityShootBowEvent event)
{
if (!GetUsers().contains(event.getEntity()))
return;
_arrows.add(event.getProjectile());
}
@EventHandler
public void ProjectileHit(ProjectileHitEvent event)
{
Projectile proj = event.getEntity();
if (proj.getShooter() == null)
return;
if (!(proj.getShooter() instanceof Player))
return;
Player damager = (Player)proj.getShooter();
if (!_arrows.contains(proj) && !GetUsers().contains(damager))
return;
//Condition
for (Player cur : UtilPlayer.getNearby(proj.getLocation(), 6))
Factory.Condition().Factory().Explosion(C.mLoot + "Meteor Arrow", cur, damager, 10, 1, false, true);
proj.getWorld().createExplosion(proj.getLocation(), 1.6f);
proj.remove();
}
@Override
public void Ability(PlayerInteractEvent event)
{
}
@EventHandler
public void Clean(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
HashSet<Entity> remove = new HashSet<Entity>();
for (Entity cur : _arrows)
if (cur.isDead() || !cur.isValid())
remove.add(cur);
for (Entity cur : remove)
_arrows.remove(cur);
}
@Override
public void ResetCustom(Player player)
{
}
}

View File

@ -1,116 +0,0 @@
package me.chiss.Core.Loot.Weapons;
import java.util.HashSet;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import me.chiss.Core.Loot.LootBase;
import me.chiss.Core.Loot.LootFactory;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType;
public class WindBlade extends LootBase
{
private HashSet<Player> _active = new HashSet<Player>();
public WindBlade(LootFactory factory)
{
super(factory, "Wind Blade", new String[]
{
"",
C.cGray + "Damage: " + C.cYellow + "7",
C.cGray + "Ability: " + C.cYellow + "Wind Rider",
C.cGray + "Knockback: " + C.cYellow + "300%",
"",
C.cWhite + "Once owned by the God Zephyrus,",
C.cWhite + "it is rumoured the Wind Blade",
C.cWhite + "grants its owner flight.",
""
},
Material.IRON_SWORD, ActionType.R, 3);
}
@Override
public void Damage(CustomDamageEvent event)
{
event.AddMod("Negate", GetName(), -event.GetDamageInitial(), false);
//Base Damage
event.AddMod(event.GetDamagerPlayer(false).getName(), C.mLoot + GetName(), 7, true);
//Double Knockback
event.AddKnockback("Wind Blade", 3);
}
@Override
public void Ability(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (player.getLocation().getBlock().isLiquid())
{
UtilPlayer.message(player, F.main(GetName(), "You cannot use " + F.skill("Wind Rider") + " in water."));
return;
}
if (!Factory.Energy().Use(player, "Wind Rider", 20, true, true))
return;
_active.add(player);
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : GetUsers())
{
if (!_active.contains(cur))
continue;
if (!cur.isBlocking())
{
_active.remove(cur);
continue;
}
if (cur.getLocation().getBlock().isLiquid())
{
UtilPlayer.message(cur, F.main(GetName(), "You cannot use " + F.skill("Wind Rider") + " in water."));
_active.remove(cur);
continue;
}
if (!Factory.Energy().Use(cur, "Wind Rider", 2, true, true))
{
_active.remove(cur);
continue;
}
UtilAction.velocity(cur, 0.6, 0.1, 1, true);
//Effect
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, 80);
cur.getWorld().playSound(cur.getLocation(), Sound.FIZZ, 1.2f, 1.5f);
}
}
@Override
public void ResetCustom(Player player)
{
_active.remove(player);
}
}

View File

@ -1,419 +0,0 @@
package me.chiss.Core.Module;
import java.util.HashSet;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import me.chiss.Core.Clans.Clans;
import me.chiss.Core.Config.Config;
import me.chiss.Core.Loot.LootFactory;
import me.chiss.Core.Field.Field;
import me.chiss.Core.Modules.*;
import me.chiss.Core.Plugin.IPlugin;
import me.chiss.Core.Plugin.IRelation;
import me.chiss.Core.Server.Server;
import mineplex.core.account.CoreClientManager;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.minecraft.core.condition.ConditionManager;
import mineplex.core.creature.Creature;
import mineplex.core.energy.Energy;
import mineplex.core.explosion.Explosion;
import mineplex.core.projectile.ProjectileManager;
import mineplex.core.recharge.Recharge;
import mineplex.core.server.IRepository;
import mineplex.core.spawn.Spawn;
import mineplex.core.teleport.Teleport;
import mineplex.minecraft.game.core.fire.Fire;
import mineplex.minecraft.game.core.mechanics.Weapon;
public abstract class AModule implements Listener
{
private IRepository _repository;
protected String _moduleName = "Default";
protected CoreClientManager _clients;
protected JavaPlugin _plugin;
protected Config _config;
protected HashSet<String> _commands;
public AModule(String moduleName, JavaPlugin plugin)
{
this(moduleName, plugin, null);
}
public AModule(String moduleName, JavaPlugin plugin, IRepository repository)
{
_moduleName = moduleName;
_plugin = plugin;
_repository = repository;
_commands = new HashSet<String>();
//Register Self
Modules().Register(this);
//Register Events
plugin.getServer().getPluginManager().registerEvents(this, _plugin);
//Enable
onEnable();
commands();
}
public IRepository GetRepository()
{
return _repository;
}
public final AModule onEnable()
{
//long epoch = System.currentTimeMillis();
Log("Initialising...");
//config(); XXX
enable();
// Log("Enabled in " + UtilTime.convertString(System.currentTimeMillis() - epoch, 1, TimeUnit.FIT) + ".");
return this;
}
public final void onDisable()
{
disable();
Log("Disabled.");
}
public void enable() { }
public void disable() { }
public void config() { }
public void commands() { }
public void command(Player caller, String cmd, String[] args) { }
public final String GetName()
{
return _moduleName;
}
public final void AddCommand(String command)
{
_commands.add(command.toLowerCase());
}
public final boolean HasCommand(String command)
{
return _commands.contains(command.toLowerCase());
}
public void Log(String data)
{
if (!(_plugin instanceof IPlugin))
return;
IPlugin plugin = (IPlugin)_plugin;
plugin.Log(_moduleName, data);
}
//Common Modules
public JavaPlugin Plugin()
{
return _plugin;
}
public ModuleManager Modules()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetModules();
}
public Config Config()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetConfig();
}
public Utility Util()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetUtility();
}
public BlockRegenerate BlockRegenerate()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetBlockRegenerate();
}
public BlockRestore BlockRestore()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetBlockRestore();
}
public Blood Blood()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetBlood();
}
public Clans Clans()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetClans();
}
public ClassFactory Classes()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetClasses();
}
public ConditionManager Condition()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetCondition();
}
public Creature Creature()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetCreature();
}
public DamageManager Damage()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetDamage();
}
public Energy Energy()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetEnergy();
}
public Explosion Explosion()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetExplosion();
}
public Field Field()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetField();
}
public Fire Fire()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetFire();
}
public Ignore Ignore()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetIgnore();
}
public Logger Logger()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetLogger();
}
public LootFactory Loot()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetLoot();
}
public Observer Observer()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetObserver();
}
public IRelation Relation()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetRelation();
}
public Recharge Recharge()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetRecharge();
}
public Server ServerM()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetServer();
}
public SkillFactory Skills()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetSkills();
}
public Spawn Spawn()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetSpawn();
}
public Teleport Teleport()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetTeleport();
}
public ProjectileManager Throw()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetThrow();
}
public Weapon Weapon()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetWeapon();
}
public SkillFactory SkillFactory()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetSkills();
}
public Wiki Wiki()
{
if (!(_plugin instanceof IPlugin))
return null;
IPlugin plugin = (IPlugin)_plugin;
return plugin.GetWiki();
}
}

View File

@ -1,29 +0,0 @@
package me.chiss.Core.Module;
import java.util.HashSet;
public class ModuleManager
{
private HashSet<AModule> _modules;
public ModuleManager()
{
_modules = new HashSet<AModule>();
}
public void Register(AModule module)
{
_modules.add(module);
}
public HashSet<AModule> GetAll()
{
return _modules;
}
public void onDisable()
{
for (AModule module : _modules)
module.onDisable();
}
}

View File

@ -1,82 +0,0 @@
package me.chiss.Core.Modules;
import java.util.HashSet;
import me.chiss.Core.Module.AModule;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
public class BlockRegenerate extends AModule
{
public HashSet<BlockRegenerateSet> _blockSets = new HashSet<BlockRegenerateSet>();
public BlockRegenerate(JavaPlugin plugin)
{
super("Block Regenerate", plugin);
}
@Override
public void enable()
{
}
@Override
public void disable()
{
for (BlockRegenerateSet sets : _blockSets)
for (int i=sets.GetBlocks().size() - 1 ; i>=0 ; i--)
sets.GetBlocks().get(i).RestoreSlow();
}
@Override
public void config()
{
}
@Override
public void commands()
{
}
@Override
public void command(Player caller, String cmd, String[] args)
{
}
public BlockRegenerateSet CreateSet(int blocksPerTick)
{
BlockRegenerateSet newSet = new BlockRegenerateSet(blocksPerTick);
_blockSets.add(newSet);
return newSet;
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
HashSet<BlockRegenerateSet> remove = new HashSet<BlockRegenerateSet>();
for (BlockRegenerateSet set : _blockSets)
if (set.IsRestoring())
for (int i=0 ; i<set.GetRate() ; i++)
{
if (!set.RestoreNext())
{
remove.add(set);
break;
}
}
}
}

View File

@ -1,59 +0,0 @@
package me.chiss.Core.Modules;
import java.util.HashSet;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R4.CraftChunk;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
public class BlockRegenerateData
{
private Location _loc;
private int _id;
private byte _data;
public BlockRegenerateData(Location loc, int id, byte data)
{
_loc = loc;
_id = id;
_data = data;
}
public Location GetBlock()
{
return _loc;
}
public int GetId()
{
return _id;
}
public byte GetData()
{
return _data;
}
public void Restore(HashSet<Chunk> _chunks)
{
_chunks.add(_loc.getChunk());
QuickRestoreBlock();
}
public void QuickRestoreBlock()
{
//if (_loc.getBlock().getType() == Material.CHEST)
// return;
net.minecraft.server.v1_7_R4.Chunk c = ((CraftChunk)_loc.getChunk()).getHandle();
c.a(_loc.getBlockX() & 0xF, _loc.getBlockY(), _loc.getBlockZ() & 0xF, _id, _data);
((CraftWorld)_loc.getChunk().getWorld()).getHandle().notify(_loc.getBlockX(), _loc.getBlockY(), _loc.getBlockZ());
}
public void RestoreSlow()
{
_loc.getBlock().setTypeIdAndData(_id, _data, true);
}
}

View File

@ -1,73 +0,0 @@
package me.chiss.Core.Modules;
import java.util.ArrayList;
import java.util.HashSet;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R4.CraftChunk;
public class BlockRegenerateSet
{
private boolean _restore = false;
private int _blocksPerTick = 10;
private int _index = 0;
private ArrayList<BlockRegenerateData> _blocks = new ArrayList<BlockRegenerateData>();
private HashSet<Chunk> _chunks = new HashSet<Chunk>();
public BlockRegenerateSet(int blocksPerTick)
{
_blocksPerTick = blocksPerTick;
}
public void AddBlock(Location loc, int id, byte data)
{
if (!_restore)
_blocks.add(new BlockRegenerateData(loc, id, data));
}
public void Start()
{
_restore = true;
_index = _blocks.size() - 1;
}
public int GetRate()
{
return _blocksPerTick;
}
public boolean IsRestoring()
{
return _restore;
}
public boolean RestoreNext()
{
if (_index < 0)
{
LightChunks();
return false;
}
_blocks.get(_index).Restore(_chunks);
_index--;
return true;
}
private void LightChunks()
{
for (Chunk chunk : _chunks)
{
net.minecraft.server.v1_7_R4.Chunk c = ((CraftChunk)chunk).getHandle();
c.initLighting();
}
}
public ArrayList<BlockRegenerateData> GetBlocks()
{
return _blocks;
}
}

View File

@ -1,101 +0,0 @@
package me.chiss.Core.Modules;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.core.MiniPlugin;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Item;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.InventoryPickupItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
public class Blood extends MiniPlugin
{
private HashMap<Item, Integer> _blood = new HashMap<Item, Integer>();
public Blood(JavaPlugin plugin)
{
super("Blood", plugin);
}
@EventHandler
public void Death(PlayerDeathEvent event)
{
Effects(event.getEntity().getEyeLocation(), 10, 0.5, Sound.HURT, 1f, 1f, Material.INK_SACK, (byte)1, true);
}
public void Effects(Location loc, int particles, double velMult, Sound sound,
float soundVol, float soundPitch, Material type, byte data, boolean bloodStep)
{
Effects(loc, particles, velMult, sound, soundVol, soundPitch, type, data, 10, bloodStep);
}
public void Effects(Location loc, int particles, double velMult, Sound sound,
float soundVol, float soundPitch, Material type, byte data, int ticks, boolean bloodStep)
{
for (int i = 0 ; i < particles ; i++)
{
Item item = loc.getWorld().dropItem(loc,
ItemStackFactory.Instance.CreateStack(type, data));
item.setVelocity(new Vector((Math.random() - 0.5)*velMult,Math.random()*velMult,(Math.random() - 0.5)*velMult));
_blood.put(item, ticks);
}
if (bloodStep)
loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 55);
loc.getWorld().playSound(loc, sound, soundVol, soundPitch);
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
HashSet<Item> expire = new HashSet<Item>();
for (Item cur : _blood.keySet())
if (cur.getTicksLived() > _blood.get(cur) || !cur.isValid())
expire.add(cur);
for (Item cur : expire)
{
cur.remove();
_blood.remove(cur);
}
}
@EventHandler
public void Pickup(PlayerPickupItemEvent event)
{
if (event.isCancelled())
return;
if (_blood.containsKey(event.getItem()))
event.setCancelled(true);
}
@EventHandler
public void HopperPickup(InventoryPickupItemEvent event)
{
if (event.isCancelled())
return;
if (_blood.containsKey(event.getItem()))
event.setCancelled(true);
}
}

View File

@ -1,288 +0,0 @@
package me.chiss.Core.Modules;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import me.chiss.Core.Module.AModule;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilWorld;
public class Compass extends AModule
{
//Search Map
private HashMap<Player, Entity> _searchMap = new HashMap<Player, Entity>();
public Compass(JavaPlugin plugin)
{
super("Compass", plugin);
}
//Module Functions
@Override
public void enable()
{
}
@Override
public void disable()
{
}
@Override
public void config()
{
}
@Override
public void commands()
{
AddCommand("compass");
AddCommand("find");
AddCommand("q");
}
@Override
public void command(Player caller, String cmd, String[] args)
{
//No Compass
if (!caller.getInventory().contains(Material.COMPASS))
{
UtilPlayer.message(caller, F.main(_moduleName, "You do not have a Compass."));
return;
}
//No Args
if (args.length < 1)
{
UtilPlayer.message(caller, F.main(_moduleName, "Missing Entity Parameter."));
return;
}
//Parse Input
if (UtilEnt.searchName(null, args[0], true) != null)
findCreature(caller, UtilEnt.searchName(null, args[0], false));
else if (args[0].equalsIgnoreCase("random"))
findRandom(caller);
else
findPlayer(caller, args[0]);
}
public void findRandom(Player caller)
{
//Recharge
if (!Recharge().use(caller, "Random Compass Search", 12000, true))
return;
//Find Players
ArrayList<Player> findList = new ArrayList<Player>();
for (Player cur : UtilServer.getPlayers())
{
if (caller.getWorld().getEnvironment() != cur.getWorld().getEnvironment())
continue;
if (Clans().CUtil().playerAlly(caller.getName(), cur.getName()))
continue;
findList.add(cur);
}
//
if (findList.size() == 0)
{
UtilPlayer.message(caller, F.main(_moduleName, "You do not have a Compass."));
return;
}
findPlayer(caller, findList.get(UtilMath.r(findList.size())).getName());
}
public void findCreature(Player caller, String name)
{
//Type
EntityType type = UtilEnt.searchEntity(null, name, false);
//Target Creature
Entity bestTarget = null;
double bestDist = 999999;
//Search World
for (Entity ent : caller.getWorld().getEntities())
if (ent.getType() == type)
{
double newDist = closer(caller, ent, bestDist);
if (newDist < bestDist)
{
bestTarget = ent;
bestDist = newDist;
}
}
//None Found
if (bestTarget == null)
{
UtilPlayer.message(caller, F.main(_moduleName, "There are no " + F.elem(name) + " nearby."));
setTarget(caller, caller);
return;
}
//Inform
UtilPlayer.message(caller, F.main(_moduleName, "The nearest " + F.elem(name) + " is at " + F.elem(UtilWorld.locToStrClean(bestTarget.getLocation())) + "."));
//Set
setTarget(caller, bestTarget);
}
public double closer(Player caller, Entity newEnt, double oldDist)
{
double newDist = caller.getLocation().toVector().subtract(newEnt.getLocation().toVector()).length();
if (newDist < oldDist)
return newDist;
return 999999999;
}
public void findPlayer(Player caller, String name)
{
Player target = UtilPlayer.searchOnline(caller, name, true);
if (target == null)
return;
if (caller.getLocation().getWorld().equals(target.getLocation().getWorld()))
{
//Inform
UtilPlayer.message(caller, F.main(_moduleName, F.name(target.getName()) + " is in " +
F.elem(UtilWorld.envToStr(caller.getLocation().getWorld().getEnvironment())) +
" at " + F.elem(UtilWorld.locToStrClean(target.getLocation())) + "."));
//Lock
setTarget(caller, target);
}
else
{
//Inform
UtilPlayer.message(caller, F.main(_moduleName, F.name(target.getName()) + " was last seen in " +
F.elem(UtilWorld.envToStr(caller.getLocation().getWorld().getEnvironment())) + "."));
//Lock
setTarget(caller, caller);
}
}
public void setTarget(Player caller, Entity target)
{
_searchMap.put(caller, target);
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player cur : UtilServer.getPlayers())
updateCompass(cur);
updateTarget();
}
@EventHandler
public void Quit(PlayerQuitEvent event)
{
_searchMap.remove(event.getPlayer());
}
public void updateCompass(Player player)
{
//No Compass
if (!player.getInventory().contains(Material.COMPASS))
{
_searchMap.remove(player);
return;
}
//Ensure
if (!_searchMap.containsKey(player))
setTarget(player,player);
//No Target
if (_searchMap.get(player).equals(player))
{
double x = player.getLocation().getX() + (Math.sin((System.currentTimeMillis()/800)%360d)*20);
double y = player.getLocation().getY();
double z = player.getLocation().getZ() + (Math.cos((System.currentTimeMillis()/800)%360d)*20);
player.setCompassTarget(new Location(player.getWorld(), x, y, z));
return;
}
//Lock
Entity target = _searchMap.get(player);
//Changed World
if (!player.getLocation().getWorld().equals(target.getLocation().getWorld()))
{
UtilPlayer.message(player, F.main(_moduleName, "Target is no longer in your World."));
setTarget(player,player);
return;
}
//Lock
player.setCompassTarget(target.getLocation());
}
public void updateTarget()
{
HashSet<Player> toRemove = new HashSet<Player>();
for (Player cur : _searchMap.keySet())
{
//Target Living
if (_searchMap.get(cur) instanceof LivingEntity)
{
LivingEntity ent = (LivingEntity)_searchMap.get(cur);
if (ent.isDead())
{
toRemove.add(cur);
UtilPlayer.message(cur, F.main(_moduleName, "Target has been killed."));
continue;
}
}
//Target Player
if (_searchMap.get(cur) instanceof Player)
{
Player ent = (Player)_searchMap.get(cur);
if (!ent.isOnline())
{
toRemove.add(cur);
UtilPlayer.message(cur, F.main(_moduleName, "Target has left the game."));
continue;
}
}
}
for (Player cur : toRemove)
setTarget(cur, cur);
}
}

View File

@ -1,253 +0,0 @@
package me.chiss.Core.Modules;
import java.util.AbstractMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.MiniPlugin;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
public class Explosion extends MiniPlugin
{
private boolean _damageEnabled = true;
private boolean _regenerateGround = false;
private HashSet<FallingBlock> _explosionBlocks = new HashSet<FallingBlock>();
private BlockRestore _blockRestore;
public Explosion(JavaPlugin plugin, BlockRestore blockRestore)
{
super("Block Restore", plugin);
_blockRestore = blockRestore;
}
@EventHandler
public void ExplosionPrime(ExplosionPrimeEvent event)
{
if (event.getRadius() >= 5)
return;
for (Block block : UtilBlock.getInRadius(event.getEntity().getLocation(), (double) event.getRadius()).keySet())
if (block.isLiquid())
block.setTypeId(0);
}
@EventHandler
public void ExplosionEntity(EntityExplodeEvent event)
{
if (event.isCancelled())
return;
try
{
if (event.getEntityType() == EntityType.CREEPER)
event.blockList().clear();
if (event.getEntityType() == EntityType.WITHER_SKULL)
event.blockList().clear();
}
catch(Exception e)
{
//Bloop
}
if (event.blockList().isEmpty())
return;
event.setYield(0f);
//Save
final HashMap<Block, Entry<Integer, Byte>> blocks = new HashMap<Block, Entry<Integer, Byte>>();
for (Block cur : event.blockList())
{
if (cur.getTypeId() == 0 || cur.isLiquid())
continue;
if (cur.getType() == Material.CHEST ||
cur.getType() == Material.IRON_ORE ||
cur.getType() == Material.COAL_ORE ||
cur.getType() == Material.GOLD_ORE ||
cur.getType() == Material.DIAMOND_ORE)
{
cur.breakNaturally();
continue;
}
blocks.put(cur, new AbstractMap.SimpleEntry<Integer, Byte>(cur.getTypeId(), cur.getData()));
if (!_regenerateGround)
{
if (cur.getTypeId() != 98 || cur.getData() != 0)
cur.setTypeId(0);
}
else
_blockRestore.Add(cur, 0, (byte)0, 10000);
}
event.blockList().clear();
//DELAY
final Entity fEnt = event.getEntity();
final Location fLoc = event.getLocation();
_plugin.getServer().getScheduler().runTaskLater(_plugin, new Runnable()
{
public void run()
{
//Launch
for (Block cur : blocks.keySet())
{
if (blocks.get(cur).getKey() == 98)
if (blocks.get(cur).getValue() == 0)
continue;
//TNT
if (blocks.get(cur).getKey() == 46)
{
TNTPrimed ent = cur.getWorld().spawn(cur.getLocation().add(0.5, 0.5, 0.5), TNTPrimed.class);
Vector vec = UtilAlg.getTrajectory(fEnt, ent);
if (vec.getY() < 0) vec.setY(vec.getY() * -1);
UtilAction.velocity(ent, vec, 1, false, 0, 0.6, 10, false);
ent.setFuseTicks(10);
}
//Other
else
{
FallingBlock fall = cur.getWorld().spawnFallingBlock(cur.getLocation().add(0.5, 0.5, 0.5), blocks.get(cur).getKey(), blocks.get(cur).getValue());
Vector vec = UtilAlg.getTrajectory(fEnt, fall);
if (vec.getY() < 0) vec.setY(vec.getY() * -1);
vec.multiply(0.6 + 0.4*Math.random());
UtilAction.velocity(fall, vec, 0.75, false, 0, 0.6, 10, false);
_explosionBlocks.add(fall);
}
}
//Items
/**
for (Item item : event.getEntity().getWorld().getEntitiesByClass(Item.class))
if (UtilMath.offset(item, event.getEntity()) < 5)
{
Vector vec = UtilAlg.getTrajectory(event.getEntity(), item);
if (vec.getY() < 0) vec.setY(vec.getY() * -1);
UtilAction.velocity(item, vec, 1, false, 0, 0.6, 10, false);
}
**/
//Crack
for (Block cur : UtilBlock.getInRadius(fLoc, 4d).keySet())
if (cur.getTypeId() == 98)
if (cur.getData() == 0)
cur.setTypeIdAndData(98, (byte)2, true);
}
}, 1);
}
@EventHandler
public void ExplosionBlockUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
HashSet<FallingBlock> fallen = new HashSet<FallingBlock>();
for (FallingBlock cur : _explosionBlocks)
{
if (cur.isDead() || !cur.isValid() || cur.getTicksLived() > 600)
fallen.add(cur);
}
for (FallingBlock cur : fallen)
{
_explosionBlocks.remove(cur);
if (cur.getTicksLived() > 600)
{
cur.remove();
continue;
}
Block block = cur.getLocation().getBlock();
block.setTypeIdAndData(0, (byte)0, true);
//Block Replace
_blockRestore.Add(block, cur.getBlockId(), cur.getBlockData(), 10000);
cur.remove();
}
}
@EventHandler
public void ExplosionItemSpawn(ItemSpawnEvent event)
{
for (FallingBlock block : _explosionBlocks)
if (UtilMath.offset(event.getEntity().getLocation(), block.getLocation()) < 1)
event.setCancelled(true);
}
@EventHandler
public void ExplosionDamage(CustomDamageEvent event)
{
if (_damageEnabled)
return;
if (event.GetCause() == DamageCause.ENTITY_EXPLOSION || event.GetCause() == DamageCause.BLOCK_EXPLOSION)
event.SetCancelled("Explosion Damage Disabled");
}
@EventHandler(priority = EventPriority.LOW)
public void ExplosionBlocks(EntityExplodeEvent event)
{
if (event.getEntity() == null)
event.blockList().clear();
}
public void SetDamage(boolean enabled)
{
_damageEnabled = enabled;
}
public void SetRegenerate(boolean regenerate)
{
_regenerateGround = regenerate;
}
public HashSet<FallingBlock> GetExplosionBlocks()
{
return _explosionBlocks;
}
}

View File

@ -1,197 +0,0 @@
package me.chiss.Core.Modules;
import java.util.ArrayList;
import java.util.HashSet;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory;
import me.chiss.Core.Module.AModule;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.plugin.java.JavaPlugin;
public class Firework extends AModule
{
private HashSet<Color> _colors;
public Firework(JavaPlugin plugin)
{
super("Firework", plugin);
}
//Module Functions
@Override
public void enable()
{
_colors = new HashSet<Color>();
_colors.add(Color.AQUA);
_colors.add(Color.BLACK);
_colors.add(Color.BLUE);
_colors.add(Color.FUCHSIA);
_colors.add(Color.GRAY);
_colors.add(Color.GREEN);
_colors.add(Color.LIME);
_colors.add(Color.MAROON);
_colors.add(Color.NAVY);
_colors.add(Color.OLIVE);
_colors.add(Color.ORANGE);
_colors.add(Color.PURPLE);
_colors.add(Color.RED);
_colors.add(Color.SILVER);
_colors.add(Color.TEAL);
_colors.add(Color.WHITE);
_colors.add(Color.YELLOW);
}
@Override
public void disable()
{
}
@Override
public void config()
{
}
@Override
public void commands()
{
AddCommand("fw");
}
@Override
public void command(Player caller, String cmd, String[] args)
{
if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true))
return;
if (args.length >= 1 && args[0].equalsIgnoreCase("type"))
{
for (Type type : Type.values())
caller.sendMessage(type.toString());
return;
}
if (args.length >= 1 && args[0].equalsIgnoreCase("color"))
{
for (Color color : _colors)
caller.sendMessage(color.toString());
return;
}
if (args.length < 4)
{
caller.sendMessage(F.link("/fw <Type> <Color,Color..> <Power> (Flicker,Trail)"));
caller.sendMessage(F.link("/fw type") + " for Type List.");
caller.sendMessage(F.link("/fw color") + " for Color List.");
return;
}
FireworkEffect fe = BuildFirework(caller, args[0], args[1], args[3]);
//Power
int power = 2;
try
{
power = Integer.parseInt(args[2]);
caller.sendMessage(F.value("Power", power+""));
}
catch (Exception e)
{
caller.sendMessage(F.value("Invalid Power", args[2]));
}
//Make Firework
ItemStack firework = ItemStackFactory.Instance.CreateStack(401, 64);
FireworkMeta fm = (FireworkMeta)firework.getItemMeta();
fm.addEffect(fe);
fm.setPower(power);
firework.setItemMeta(fm);
caller.setItemInHand(firework);
}
public FireworkEffect BuildFirework(Player caller, String typeString, String colorString, String specialString)
{
//Type
Type type = Type.BALL;
for (Type cur : Type.values())
if (typeString.equalsIgnoreCase(cur.toString()))
{
caller.sendMessage(F.value("Type", type.toString()));
type = cur;
break;
}
//Colors
ArrayList<Color> colors = new ArrayList<Color>();
colorString = colorString.toLowerCase();
for (String colorToken : colorString.split(","))
{
ArrayList<Color> matchList = new ArrayList<Color>();
Color match = null;
for (Color cur : _colors)
{
if (cur.toString().toLowerCase().equals(colorToken))
{
match = cur;
break;
}
else if (cur.toString().toLowerCase().contains(colorToken))
{
matchList.add(cur);
}
}
if (match != null)
{
caller.sendMessage(F.value("Added Color", match.toString()));
colors.add(match);
}
else if (!matchList.isEmpty())
{
if (matchList.size() == 1)
{
caller.sendMessage(F.value("Added Color", matchList.get(0).toString()));
colors.add(matchList.get(0));
}
else
{
caller.sendMessage(F.value("Multiple Color Matches", colorToken));
}
}
else
{
caller.sendMessage(F.value("No Color Matches", colorToken));
}
}
if (colors.isEmpty())
colors.add(Color.WHITE);
boolean flicker = false;
boolean trail = false;
if (specialString.toLowerCase().contains("flicker") ||
specialString.toLowerCase().contains("flick") ||
specialString.toLowerCase().contains("f"))
flicker = true;
if (specialString.toLowerCase().contains("trail") ||
specialString.toLowerCase().contains("t"))
flicker = true;
return FireworkEffect.builder().flicker(flicker).trail(trail)
.withColor(colors).withFade(colors).with(type).build();
}
}

View File

@ -1,237 +0,0 @@
package me.chiss.Core.Modules;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.plugin.java.JavaPlugin;
import me.chiss.Core.Module.AModule;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilWorld;
public class Fix extends AModule
{
public Fix(JavaPlugin plugin)
{
super("Glitch Fix", plugin);
}
//Module Functions
@Override
public void enable()
{
}
@Override
public void disable()
{
}
@Override
public void config()
{
}
@Override
public void commands()
{
AddCommand("speed1");
AddCommand("speed2");
AddCommand("speed3");
AddCommand("speed4");
AddCommand("speed5");
}
@Override
public void command(Player caller, String cmd, String[] args)
{
if (cmd.equals("speed1"))
Condition().Factory().Speed("test", caller, caller, 20, 0, false, true);
if (cmd.equals("speed2"))
Condition().Factory().Speed("test", caller, caller, 20, 1, false, true);
if (cmd.equals("speed3"))
Condition().Factory().Speed("test", caller, caller, 20, 2, false, true);
if (cmd.equals("speed4"))
Condition().Factory().Speed("test", caller, caller, 20, 3, false, true);
if (cmd.equals("speed5"))
Condition().Factory().Speed("test", caller, caller, 20, 4, false, true);
}
@EventHandler
public void fixDoorGlitch(BlockPlaceEvent event)
{
if (event.getBlock().getTypeId() != 64)
return;
//Make Iron Door
event.getBlockPlaced().setType(Material.IRON_DOOR_BLOCK);
//Inform
UtilPlayer.message(event.getPlayer(), F.main(_moduleName, "Please use Iron Doors."));
}
@EventHandler
public void fixWallClimb(BlockBreakEvent event)
{
if (!event.isCancelled())
return;
Block player = event.getPlayer().getLocation().getBlock();
Block block = event.getBlock();
if (player.getRelative(BlockFace.DOWN).getTypeId() != 0)
return;
if (block.getY() != player.getY() + 2)
return;
//One HAS to be the same.
if (block.getX() != player.getX() && block.getZ() != player.getZ())
return;
//One HAS to be offset by 1.
if (Math.abs(block.getX() - player.getX()) != 1 && Math.abs(block.getZ() - player.getZ()) != 1)
return;
//Teleport
Teleport().TP(event.getPlayer(), UtilWorld.locMerge(event.getPlayer().getLocation(), player.getLocation().add(0.5, 0, 0.5)));
//Inform
UtilPlayer.message(event.getPlayer(), F.main(_moduleName, "Wall Climb Prevented."));
}
@EventHandler
public void fixBlockClimb(PlayerInteractEvent event)
{
if (!event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (!UtilBlock.isBlock(event.getPlayer().getItemInHand()))
return;
Block player = event.getPlayer().getLocation().getBlock();
Block block = event.getClickedBlock().getRelative(event.getBlockFace());
if (
Math.abs(event.getPlayer().getLocation().getX() - ((double)block.getX()+0.5)) > 0.8 ||
Math.abs(event.getPlayer().getLocation().getZ() - ((double)block.getZ()+0.5)) > 0.8 ||
player.getY() < block.getY() || player.getY() > block.getY() + 1)
return;
if (!UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
return;
//Teleport
event.getPlayer().teleport(UtilWorld.locMerge(event.getPlayer().getLocation(), block.getLocation().add(0.5, 0, 0.5)));
//Inform
UtilPlayer.message(event.getPlayer(), F.main(_moduleName, "Block Climb Prevented."));
}
/*
private HashMap<Player, Entry<Long,Location>> _sprintMonitor = new HashMap<Player, Entry<Long,Location>>();
@EventHandler(priority = EventPriority.MONITOR)
public void fixSprintMod(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
Player player = event.GetDamagerPlayer(false);
if (player == null) return;
if (!UtilEnt.isGrounded(player))
return;
if (!_sprintMonitor.containsKey(player))
_sprintMonitor.put(player, new AbstractMap.SimpleEntry<Long, Location>(System.currentTimeMillis(), player.getLocation()));
}
@EventHandler
public void fixSprintMove(PlayerMoveEvent event)
{
if (!_sprintMonitor.containsKey(event.getPlayer()))
return;
if (!UtilEnt.isGrounded(event.getPlayer()))
{
_sprintMonitor.remove(event.getPlayer());
return;
}
if (event.getPlayer().getLocation().getBlock().isLiquid())
{
_sprintMonitor.remove(event.getPlayer());
return;
}
if (System.currentTimeMillis() - _sprintMonitor.get(event.getPlayer()).getKey() < 100)
return;
if (event.getPlayer().isSprinting())
{
_sprintMonitor.remove(event.getPlayer());
return;
}
double limit = 0.22;
for (PotionEffect pe : event.getPlayer().getActivePotionEffects())
if (pe.getType().equals(PotionEffectType.SPEED))
{
if (pe.getAmplifier() == 0) limit = 0.26;
else if (pe.getAmplifier() == 1) limit = 0.30;
else if (pe.getAmplifier() == 2) limit = 0.34;
else if (pe.getAmplifier() == 3) limit = 0.39;
else if (pe.getAmplifier() == 4) limit = 0.43;
}
if (UtilMath.offset(event.getFrom(), event.getTo()) < limit)
{
_sprintMonitor.remove(event.getPlayer());
return;
}
if (System.currentTimeMillis() - _sprintMonitor.get(event.getPlayer()).getKey() > 400)
{
_sprintMonitor.remove(event.getPlayer());
Condition().Factory().Slow("Sprint Hack", event.getPlayer(), event.getPlayer(), 12, 4, false, true, true);
Condition().Factory().Weakness("Sprint Hack", event.getPlayer(), event.getPlayer(), 12, 4, false, true);
Condition().Factory().Poison("Sprint Hack", event.getPlayer(), event.getPlayer(), 12, 0, false, true);
//Inform
UtilPlayer.message(event.getPlayer(), F.main(_moduleName, "Sprint Hack Prevented."));
System.out.println("Sprint Hack: " + event.getPlayer().getName());
}
}
@EventHandler
public void fixSprintQuit(PlayerQuitEvent event)
{
_sprintMonitor.remove(event.getPlayer());
}
@EventHandler
public void fixSprintDamage(CustomDamageEvent event)
{
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
_sprintMonitor.remove(damagee);
}*/
}

View File

@ -1,152 +0,0 @@
package me.chiss.Core.Modules;
import java.util.LinkedList;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory;
import me.chiss.Core.Module.AModule;
public class Give extends AModule
{
public Give(JavaPlugin plugin)
{
super("Give", plugin);
}
//Module Functions
@Override
public void enable()
{
}
@Override
public void disable()
{
}
@Override
public void config()
{
}
@Override
public void commands()
{
AddCommand("g");
}
@Override
public void command(Player caller, String cmd, String[] args)
{
if (args.length == 0)
help(caller);
else if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true))
return;
else if (args.length == 1)
give(caller, caller.getName(), args[0], "1");
else if (args.length == 2)
give(caller, args[0], args[1], "1");
else
give(caller, args[0], args[1], args[2]);
}
public void help(Player caller)
{
UtilPlayer.message(caller, F.main("Give", "Commands List;"));
UtilPlayer.message(caller, F.help("/g <item> (amount)", "Give Item to Self", Rank.ADMIN));
UtilPlayer.message(caller, F.help("/g <player> <item> (amount)", "Give Item to Player", Rank.ADMIN));
}
public void give(Player caller, String target, String name, String amount)
{
//Item
LinkedList<Material> itemList = new LinkedList<Material>();
itemList = Util().Items().matchItem(caller, name, true);
if (itemList.isEmpty()) return;
//Player
LinkedList<Player> giveList = new LinkedList<Player>();
if (target.equalsIgnoreCase("all"))
{
for (Player cur : UtilServer.getPlayers())
giveList.add(cur);
}
else
{
giveList = UtilPlayer.matchOnline(caller, target, true);
if (giveList.isEmpty()) return;
}
//Amount
int count = 1;
try
{
count = Integer.parseInt(amount);
if (count < 1)
{
UtilPlayer.message(caller, F.main("Give", "Invalid Amount [" + amount + "]. Defaulting to [1]."));
count = 1;
}
}
catch (Exception e)
{
UtilPlayer.message(caller, F.main("Give", "Invalid Amount [" + amount + "]. Defaulting to [1]."));
}
//Create
String givenList = "";
for (Player cur : giveList)
givenList += cur.getName() + " ";
if (givenList.length() > 0)
givenList = givenList.substring(0, givenList.length()-1);
for (Material curItem : itemList)
{
for (Player cur : giveList)
{
ItemStack stack = ItemStackFactory.Instance.CreateStack(curItem, count);
//Give
if (UtilInv.insert(cur, stack))
{
//Inform
if (!cur.equals(caller))
UtilPlayer.message(cur, F.main("Give", "You received " + F.item(count + " " + ItemStackFactory.Instance.GetName(curItem, (byte)0, false)) + " from " + F.elem(caller.getName()) + "."));
}
}
if (target.equalsIgnoreCase("all"))
UtilPlayer.message(caller, F.main("Give", "You gave " + F.item(count + " " + ItemStackFactory.Instance.GetName(curItem, (byte)0, false)) + " to " + F.elem("ALL")) + ".");
else if (giveList.size() > 1)
UtilPlayer.message(caller, F.main("Give", "You gave " + F.item(count + " " + ItemStackFactory.Instance.GetName(curItem, (byte)0, false)) + " to " + F.elem(givenList) + "."));
else
UtilPlayer.message(caller, F.main("Give", "You gave " + F.item(count + " " + ItemStackFactory.Instance.GetName(curItem, (byte)0, false)) + " to " + F.elem(giveList.getFirst().getName()) + "."));
//Log
Log("Gave [" + count + " " + ItemStackFactory.Instance.GetName(curItem, (byte)0, false) + "] to [" + givenList + "] from [" + caller.getName() + "].");
}
}
}

View File

@ -1,87 +0,0 @@
package me.chiss.Core.Modules;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import me.chiss.Core.Module.AModule;
import mineplex.core.server.IRepository;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
public class Ignore extends AModule
{
public Ignore(JavaPlugin plugin, IRepository repository)
{
super("Ignore", plugin, repository);
}
//Module Functions
@Override
public void enable()
{
}
@Override
public void disable()
{
}
@Override
public void config()
{
}
@Override
public void commands()
{
AddCommand("ignore");
AddCommand("i");
}
@Override
public void command(Player caller, String cmd, String[] args)
{
if (args.length == 0)
return; //UtilPlayer.message(caller, Clients().Get(caller).Ignore().Display());
else
ignore(caller, args[0]);
}
public void ignore(final Player caller, final String arg)
{
if (!Recharge().use(caller, "Ignore Command", 2000, true))
return;
GetRepository().matchPlayerName(new Callback<List<String>>()
{
public void run(List<String> matches)
{
UtilPlayer.searchOffline(matches, new Callback<String>()
{
public void run(String target)
{
if (target == null)
return;
if (!caller.isOnline())
return;
boolean muted = Clients().Get(caller).Ignore().ToggleIgnore(target);
if (muted) UtilPlayer.message(caller, F.main(_moduleName, "You ignored " + F.name(target) + "."));
else UtilPlayer.message(caller, F.main(_moduleName, "You unignored " + F.name(target) + "."));
}
}, caller, arg, true);
}
}, arg);
}
}

View File

@ -1,304 +0,0 @@
package me.chiss.Core.Modules;
import java.util.LinkedList;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import me.chiss.Core.Module.AModule;
import mineplex.core.account.CoreClient;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
public class Information extends AModule
{
public Information(JavaPlugin plugin)
{
super("Client Information", plugin);
AddCommand("x");
AddCommand("info");
}
@Override
public void command(Player caller, String cmd, String[] args)
{
if (args.length == 0 || args[0].equals("help"))
{
help(caller);
return;
}
Handle(caller, args);
}
private void help(Player caller)
{
}
public void Handle(Player caller, String[] args)
{
//Get Client
CoreClient target = null;
if (args.length >= 2)
{
Player other = UtilPlayer.searchOnline(caller, args[1], true);
if (other == null)
{
UtilPlayer.message(caller, C.cDGray + "-- Offline Player Data Coming Soon --");
return;
}
target = Clients().Get(other);
}
else
{
target = Clients().Get(caller);
}
if (target == null)
return;
//Element
if (args[0].equals("acc") || args[0].equals("account"))
Account(caller, target);
else if (args[0].equals("acc"))
Account(caller, target);
else if (args[0].equals("nac"))
NAC(caller, target);
else if (args[0].equals("ban"))
Ban(caller, target);
else if (args[0].equals("mute"))
Mute(caller, target);
else if (args[0].equals("alias"))
Alias(caller, target);
else if (args[0].equals("clan"))
Clan(caller, target);
else if (args[0].equals("ignore"))
Ignore(caller, target);
}
public void Account(Player caller, CoreClient target)
{
CoreClient self = Clients().Get(caller);
LinkedList<String> out = new LinkedList<String>();
//Header
out.add(F.main(GetName(), "Account Information - " + target.GetPlayerName()));
//Public
out.add(F.value("Play Time", UtilTime.convertString(target.Acc().GetPlayTime(), 1, TimeUnit.FIT)));
out.add(F.value("Play Count", target.Acc().GetLoginCount()+""));
out.add(F.value("Last Login", UtilTime.convertString(System.currentTimeMillis() - target.Acc().GetLoginLast(), 1, TimeUnit.FIT) + " Ago"));
//IP Alias > Mod
if (self.Rank().Has(Rank.MODERATOR, false))
{
out.add(F.value("IP Count", target.Acc().GetListIP().size() + ""));
String alias = "";
for (String cur :target.Acc().GetAliasIP())
alias += cur + " ";
if (alias.length() == 0)
alias = "None";
out.add(F.value("IP Alias", alias));
}
//MAC Alias > Admin
if (self.Rank().Has(Rank.ADMIN, false))
{
out.add(F.value("MAC Count", target.Acc().GetListMAC().size() + ""));
String alias = "";
for (String cur : target.Acc().GetAliasMAC())
alias += cur + " ";
if (alias.length() == 0)
alias = "None";
out.add(F.value("MAC Alias", alias));
}
//Send
UtilPlayer.message(caller, out);
}
public void NAC(Player caller, CoreClient target)
{
CoreClient self = Clients().Get(caller);
LinkedList<String> out = new LinkedList<String>();
//Header
out.add(F.main(GetName(), "NAC Information - " + target.GetPlayerName()));
//Requirement
if (target.NAC().IsRequired())
{
if (target.NAC().GetRequired())
{
out.add(F.value("Required", "True", true));
out.add(F.value(1, "Date", target.NAC().GetDate()));
out.add(F.value(1, "Admin", target.NAC().GetAdmin()));
out.add(F.value(1, "Reason", target.NAC().GetReason()));
}
else
{
out.add(F.value("Required", "True", true));
out.add(F.value(1, "Time Played", UtilTime.convertString(target.Acc().GetPlayTime(), 1, TimeUnit.FIT)));
}
}
else
{
out.add(F.value("Required", "False", false));
out.add(F.value(1, "Time Played", UtilTime.convertString(target.Acc().GetPlayTime(), 1, TimeUnit.FIT)));
out.add(F.value(1, "Required In", UtilTime.convertString(target.NAC().GetRequireTime() - target.Acc().GetPlayTime(), 1, TimeUnit.FIT)));
}
if (!UtilPlayer.isOnline(target.GetPlayerName()))
return;
//Usage
if (target.NAC().IsUsing())
{
out.add(F.value("Using CAH", "True", true));
out.add(F.value(1, "Build", target.NAC().GetPack()));
if (self.Rank().Has(Rank.ADMIN, false))
out.add(F.value(1, "Token", target.NAC().GetToken()));
}
else
{
out.add(F.value("Using CAH", "False", false));
if (self.Rank().Has(Rank.ADMIN, false))
{
out.add(F.value(1, "Build", target.NAC().GetPack()));
out.add(F.value(1, "Token", target.NAC().GetToken()));
}
}
//Send
UtilPlayer.message(caller, out);
}
public void Ban(Player caller, CoreClient target)
{
LinkedList<String> out = new LinkedList<String>();
//Header
out.add(F.main(GetName(), "Ban Information - " + target.GetPlayerName()));
if (target.Ban().GetBan() != null)
{
out.add(F.value(1, "Banned", F.tf(true)));
out.add(F.value(1, "Date", UtilTime.when(target.Ban().GetBan().GetBanTime())));
out.add(F.value(1, "Duration", UtilTime.convertString(target.Ban().GetBan().GetBanDuration(), 1, TimeUnit.FIT)));
if (target.Ban().GetBan().GetBanDuration() > 0)
out.add(F.value(1, "Remaining", target.Ban().GetBan().RemainingString()));
out.add(F.value(1, "Admin", target.Ban().GetBan().GetAdmin()));
out.add(F.value(1, "Rank", target.Ban().GetBan().GetRank().toString()));
out.add(F.value(1, "Reason", target.Ban().GetBan().GetReason()));
if (target.Ban().GetBan().IsAliasBan()) out.add(F.value(1, "Alias Ban", "True", true));
else out.add(F.value(1, "Alias Ban", "False", false));
if (!target.Ban().GetBan().Active()) out.add(F.value(1, "Unbanned", "True", true));
else out.add(F.value(1, "Unbanned", "False", false));
}
else
{
out.add(F.value(1, "Banned", F.tf(false)));
}
//Send
UtilPlayer.message(caller, out);
}
public void Mute(Player caller, CoreClient target)
{
LinkedList<String> out = new LinkedList<String>();
//Header
out.add(F.main(GetName(), "Mute Information - " + target.GetPlayerName()));
//Send
UtilPlayer.message(caller, out);
}
public void Alias(Player caller, CoreClient target)
{
LinkedList<String> out = new LinkedList<String>();
//Header
out.add(F.main(GetName(), "Alias Information - " + target.GetPlayerName()));
//Send
UtilPlayer.message(caller, out);
}
public void Clan(Player caller, CoreClient target)
{
LinkedList<String> out = new LinkedList<String>();
//Header
out.add(F.main(GetName(), "Clan Information - " + target.GetPlayerName()));
if (target.Clan().GetClanName().equals(""))
{
out.add(F.value("Clan", "No Clan", false));
}
else
{
out.add(F.value("Clan", target.Clan().GetClanName()));
out.add(F.value("Invited By", target.Clan().GetInviter()));
}
if (target.Clan().CanJoin())
out.add(F.value("Leave Timer", "No Timer", true));
else
out.add(F.value("Leave Timer", UtilTime.convertString(System.currentTimeMillis() - target.Clan().GetDelay(), 1, TimeUnit.FIT), false));
//Send
UtilPlayer.message(caller, out);
}
public void Ignore(Player caller, CoreClient target)
{
LinkedList<String> out = new LinkedList<String>();
//Header
out.add(F.main(GetName(), "Ignore Information - " + target.GetPlayerName()));
String ignoreString = "";
for (String cur : UtilAlg.sortKey(target.Ignore().GetIgnored()))
ignoreString += cur + " ";
if (ignoreString.length() == 0)
ignoreString = "Empty";
out.add(F.value("Ignore List", ignoreString));
//Send
UtilPlayer.message(caller, out);
}
}

View File

@ -1,22 +0,0 @@
package me.chiss.Core.Modules;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.common.util.F;
public class JoinQuit
{
@EventHandler
public void Join(PlayerJoinEvent event)
{
event.setJoinMessage(F.sys("Join", event.getPlayer().getName()));
}
@EventHandler
public void Quit(PlayerQuitEvent event)
{
event.setQuitMessage(F.sys("Quit", event.getPlayer().getName()));
}
}

View File

@ -1,100 +0,0 @@
package me.chiss.Core.Modules;
import me.chiss.Core.Module.AModule;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class Logger extends AModule
{
public Logger(JavaPlugin plugin)
{
super("Logger", plugin);
}
//Module Functions
@Override
public void enable()
{
}
@Override
public void disable()
{
}
@Override
public void config()
{
}
@Override
public void commands()
{
}
@Override
public void command(Player caller, String cmd, String[] args)
{
}
@EventHandler
public void handleCommand(PlayerCommandPreprocessEvent event)
{
/*
String statement = "INSERT INTO log_command (client, command, location, date, systime) VALUES (?, ?, ?, ?, ?)";
try
{
PreparedStatement stmt = SQL().prepareStatement(statement, DB.LOCAL);
stmt.setString(1, event.getPlayer().getName());
stmt.setString(2, event.getMessage());
stmt.setString(3, UtilWorld.locToStr(event.getPlayer().getLocation()));
stmt.setString(4, UtilTime.now());
stmt.setLong(5, System.currentTimeMillis());
SQL().doStatement(stmt, DB.LOCAL, true);
}
catch (SQLException e)
{
Log("Statement: " + statement);
Log(DB.LOCAL + " Error: " + e.getMessage());
}
*/
}
public void logChat(String type, Player from, String to, String message)
{
/*
String statement = "INSERT INTO log_chat (date, type, m_from, m_to, message, location, systime) VALUES (?, ?, ?, ?, ?, ?, ?)";
try
{
PreparedStatement stmt = SQL().prepareStatement(statement, DB.LOCAL);
stmt.setString(1, UtilTime.now());
stmt.setString(2, type);
stmt.setString(3, from.getName());
stmt.setString(4, to);
stmt.setString(5, message);
stmt.setString(6, UtilWorld.locToStrClean(from.getLocation()));
stmt.setLong(7, System.currentTimeMillis());
SQL().doStatement(stmt, DB.LOCAL, true);
}
catch (SQLException e)
{
Log("Statement: " + statement);
Log(DB.LOCAL + " Error: " + e.getMessage());
}
*/
}
}

View File

@ -1,216 +0,0 @@
package me.chiss.Core.Modules;
import java.util.WeakHashMap;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import me.chiss.Core.Module.AModule;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemStackFactory;
public class Observer extends AModule
{
private WeakHashMap<Player, Location> _obs = new WeakHashMap<Player, Location>();
public Observer(JavaPlugin plugin)
{
super("Observer", plugin);
}
//Module Functions
@Override
public void enable()
{
}
@Override
public void disable()
{
for (Player player : _obs.keySet())
remove(player, false);
}
@Override
public void config()
{
}
@Override
public void commands()
{
AddCommand("o");
AddCommand("obs");
AddCommand("observer");
AddCommand("z");
}
@Override
public void command(Player caller, String cmd, String[] args)
{
if (!Clients().Get(caller).Rank().Has(Rank.MODERATOR, true))
return;
if (isObserver(caller, false)) remove(caller, true);
else add(caller, true);
}
@EventHandler
public void handleJoin(PlayerQuitEvent event)
{
event.getPlayer().setGameMode(GameMode.SURVIVAL);
remove(event.getPlayer(), false);
}
public void add(Player player, boolean inform)
{
_obs.put(player, player.getLocation());
player.setGameMode(GameMode.CREATIVE);
UtilInv.Clear(player);
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.WEB, 1));
if (inform)
UtilPlayer.message(player, F.main(_moduleName, "You entered Observer Mode."));
}
public boolean remove(Player player, boolean inform)
{
Location loc = _obs.remove(player);
if (loc != null && inform)
{
UtilPlayer.message(player, F.main(_moduleName, "You left Observer Mode."));
player.setGameMode(GameMode.SURVIVAL);
UtilInv.Clear(player);
Teleport().TP(player, loc);
return true;
}
return false;
}
public boolean isObserver(Player player, boolean adminReq)
{
if (adminReq)
{
if (_obs.containsKey(player) && Clients().Get(player).Rank().Has(Rank.ADMIN, false))
return true;
}
else if (_obs.containsKey(player))
return true;
return false;
}
//Invisible
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player player : _obs.keySet())
Condition().Factory().Cloak("Observer", player, player, 1.9, false, true);
}
//Inventory Open
@EventHandler
public void handleInventoryOpen(InventoryOpenEvent event)
{
//Not Obs
if (!_obs.containsKey((Entity)event.getPlayer()))
return;
//Non-Admin > DISALLOW ALL
if (!Clients().Get(event.getPlayer().getName()).Rank().Has(Rank.ADMIN, false))
{
UtilPlayer.message(UtilPlayer.searchExact(event.getPlayer().getName()), F.main(_moduleName, "You cannot open Inventory."));
event.setCancelled(true);
return;
}
}
@EventHandler
public void handleInventoryClick(InventoryClickEvent event)
{
//Not Obs
if (!_obs.containsKey((Entity)event.getWhoClicked()))
return;
UtilPlayer.message(UtilPlayer.searchExact(event.getWhoClicked().getName()), F.main(_moduleName, "You cannot interact with Inventory."));
event.getWhoClicked().closeInventory();
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
public void handlePickup(PlayerPickupItemEvent event)
{
if (event.isCancelled())
return;
if (_obs.containsKey((Entity)event.getPlayer()))
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
public void handleDrop(PlayerDropItemEvent event)
{
if (event.isCancelled())
return;
if (_obs.containsKey((Entity)event.getPlayer()))
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
public void handleBlockPlace(BlockPlaceEvent event)
{
if (event.isCancelled())
return;
if (_obs.containsKey((Entity)event.getPlayer()))
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
public void handleBlockBreak(BlockBreakEvent event)
{
if (event.isCancelled())
return;
if (_obs.containsKey((Entity)event.getPlayer()))
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
public void handleDamage(CustomDamageEvent event)
{
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
if (_obs.containsKey((Entity)damager))
event.SetCancelled("Observer Mode");
}
}

View File

@ -1,70 +0,0 @@
package me.chiss.Core.Modules;
import me.chiss.Core.ClientData.ClientPlayer;
import me.chiss.Core.Module.AModule;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class PlayerInfo extends AModule
{
public PlayerInfo(JavaPlugin plugin)
{
super("Player Update", plugin);
}
//Module Functions
@Override
public void enable()
{
}
@Override
public void disable()
{
}
@Override
public void config()
{
}
@Override
public void commands()
{
}
@Override
public void command(Player caller, String cmd, String[] args)
{
}
@EventHandler
public void handleInteract(PlayerInteractEvent event)
{
if (event.getAction() == Action.PHYSICAL)
return;
Clients().Get(event.getPlayer()).Player().SetLastAction(System.currentTimeMillis());
}
@EventHandler
public void handleJoin(PlayerJoinEvent event)
{
Clients().Get(event.getPlayer()).Acc().SetLoginLast(System.currentTimeMillis());
}
}

View File

@ -1,521 +0,0 @@
package me.chiss.Core.Modules;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import me.chiss.Core.Clans.ClanInfo;
import me.chiss.Core.Clans.ClansUtility.ClanRelation;
import me.chiss.Core.ClientData.ClientGame;
import me.chiss.Core.Module.AModule;
import me.chiss.Core.Scheduler.IScheduleListener;
import me.chiss.Core.Scheduler.Scheduler;
import mineplex.core.server.IRepository;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.donation.repository.token.PlayerUpdateToken;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.inventory.InventoryPickupItemEvent;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class PointManager extends AModule implements IScheduleListener
{
private IRepository Repository;
private long _interval = 900000;
private String _folder = "data/pph/";
private HashMap<String, Long> _quitMap = new HashMap<String, Long>();
private HashMap<String, Integer> _pointTotals = new HashMap<String, Integer>();
private int _maxPPH;
private int _pphOnline;
private int _pphOnlineClan;
private int _pphOfflineClan;
private int _pphOnlinePet;
private int _pphOfflinePet;
private int _pphNAC;
public PointManager(JavaPlugin plugin, Scheduler scheduler, IRepository repository, int maxPPH, int pphOnline, int pphOnlineClanAge, int pphOfflineClanAge, int pphOnlinePetLevel, int pphOfflinePetLevel, int pphNAC)
{
super("Point Manager", plugin);
scheduler.ScheduleDailyRecurring(this, 0);
Repository = repository;
//Dir
File file = new File(_folder);
file.mkdirs();
_maxPPH = maxPPH;
_pphOnline = pphOnline;
_pphOnlineClan = pphOnlineClanAge;
_pphOfflineClan = pphOfflineClanAge;
_pphOnlinePet = pphOnlinePetLevel;
_pphOfflinePet = pphOfflinePetLevel;
_pphNAC = pphNAC;
}
//Module Functions
@Override
public void enable()
{
}
@Override
public void disable()
{
}
@Override
public void config()
{
}
@Override
public void commands()
{
}
@Override
public void command(Player caller, String cmd, String[] args)
{
}
@EventHandler(priority = EventPriority.LOWEST)
public void Drop(PlayerDropItemEvent event)
{
if (event.isCancelled())
return;
if (event.getItemDrop().getItemStack().getType() != Material.EMERALD)
return;
UtilPlayer.message(event.getPlayer(), F.main("Loot", "You cannot drop " + F.item("Emerald") + "."));
event.setCancelled(true);
}
@EventHandler
public void Pickup(PlayerPickupItemEvent event)
{
if (event.isCancelled())
return;
if (event.getItem().getItemStack().getType() != Material.EMERALD)
return;
//Effect
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 0.5f, 1f);
}
@EventHandler
public void HopperPickup(InventoryPickupItemEvent event)
{
if (event.isCancelled())
return;
if (event.getItem().getItemStack().getType() != Material.EMERALD)
return;
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
public void Inventory(InventoryOpenEvent event)
{
if (event.isCancelled())
return;
if (!event.getPlayer().getInventory().contains(Material.EMERALD))
return;
UtilPlayer.message(event.getPlayer(), F.main("Loot", "You cannot use this while holding " + F.item("Emerald") + "."));
event.setCancelled(true);
}
@EventHandler
public void Deposit(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (player.getItemInHand() == null)
return;
if (player.getItemInHand().getType() != Material.EMERALD)
return;
if (!Clans().CUtil().isClaimed(player.getLocation()) ||
Clans().CUtil().getAccess(player, player.getLocation()) != ClanRelation.SELF)
{
UtilPlayer.message(event.getPlayer(), F.main("Loot", "You can only claim " + F.item("Emerald") +
" in your Territory."));
return;
}
int amount = UtilInv.removeAll(player, Material.EMERALD, (byte)0);
int per = 1000;
UtilPlayer.message(event.getPlayer(), F.main("Loot", "You claimed " + F.item(amount + " Emeralds") +
" for " + F.count((amount * per) + " Coins") + "."));
//Economy
Clients().Get(player).Game().ModifyEconomyBalance(amount * per);
//Effect
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 2f);
}
@EventHandler(priority = EventPriority.HIGHEST)
public void AsyncLogin(AsyncPlayerPreLoginEvent event)
{
if (event.getLoginResult() != Result.ALLOWED)
return;
long quit = ReadQuit(event.getName());
Clients().Get(event.getName()).Game().SetLastPPH(System.currentTimeMillis());
if (!UtilTime.elapsed(quit, 3600000))
return;
_quitMap.put(event.getName(), quit);
WriteQuit(event.getName());
}
@EventHandler
public void Quit(PlayerQuitEvent event)
{
_quitMap.remove(event.getPlayer().getName());
WriteQuit(event.getPlayer().getName());
}
@EventHandler
public void UpdateOffline(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
return;
for (String name : _quitMap.keySet())
{
Player cur = UtilPlayer.searchExact(name);
if (cur == null) continue;
boolean capped = false;
if (!_pointTotals.containsKey(cur.getName()))
_pointTotals.put(cur.getName(), 0);
if ( _pointTotals.get(cur.getName()) >= _maxPPH)
capped = true;
if (capped)
{
UtilPlayer.message(cur, "§c§lYou have already earned the max of " + _maxPPH + " Points today.");
UtilPlayer.message(cur, F.value("You will earn more in:", UtilTime.convertString(Scheduler.Instance.GetTimeTilNextAppt(this), 1, TimeUnit.FIT)));
continue;
}
double hours = (System.currentTimeMillis() - _quitMap.get(name)) / 3600000d;
if (hours > 12)
hours = 12;
double petLevel = 0;
double clanAge = 0;
ClanInfo clan = Clans().CUtil().getClanByPlayer(cur);
if (clan != null) clanAge = (System.currentTimeMillis() - clan.GetDateCreated()) / 86400000d;
if (clanAge > 7)
clanAge = 7;
int clanPoints = (int) (_pphOfflineClan * clanAge * hours);
int petPoints = (int) (_pphOfflinePet * petLevel * hours);
int totalPoints = clanPoints + petPoints;
boolean hitCap = false;
if (totalPoints == 0)
continue;
else if (totalPoints + _pointTotals.get(cur.getName()) > _maxPPH)
{
hitCap = true;
totalPoints = _maxPPH - _pointTotals.get(cur.getName());
}
UtilPlayer.message(cur, "§c§lOffline Point Reward - " + UtilTime.convertString(System.currentTimeMillis() - _quitMap.get(name), 1, TimeUnit.FIT));
UtilPlayer.message(cur, F.value("Clan Age", clanPoints + " Points"));
UtilPlayer.message(cur, F.value("Battle Pet", petPoints + " Points"));
UtilPlayer.message(cur, "You received " + F.count(totalPoints + " Points") + ".");
if (hitCap)
{
UtilPlayer.message(cur, "§c§lYou have already earned the max of " + _maxPPH + " Points today.");
UtilPlayer.message(cur, F.value("You will earn more in:", UtilTime.convertString(Scheduler.Instance.GetTimeTilNextAppt(this), 1, TimeUnit.FIT)));
}
//Effect
cur.playSound(cur.getLocation(), Sound.LEVEL_UP, 1f, 2f);
//Give Points
PlayerUpdateToken token = new PlayerUpdateToken();
token.Name = cur.getName();
token.Points = totalPoints;
Repository.PlayerUpdate(null, token);
_pointTotals.put(cur.getName(), _pointTotals.get(cur.getName()) + totalPoints);
}
_quitMap.clear();
}
@EventHandler
public void UpdateOnline(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
return;
for (Player cur : UtilServer.getPlayers())
{
boolean capped = false;
if (!_pointTotals.containsKey(cur.getName()))
_pointTotals.put(cur.getName(), 0);
if ( _pointTotals.get(cur.getName()) >= _maxPPH)
capped = true;
ClientGame client = Clients().Get(cur).Game();
if (!UtilTime.elapsed(client.GetLastPPH(), _interval)) //15 Minutes
continue;
client.SetLastPPH(System.currentTimeMillis());
if (capped)
{
UtilPlayer.message(cur, "§c§lYou have already earned the max of " + _maxPPH + " Points today.");
UtilPlayer.message(cur, F.value("You will earn more in:", UtilTime.convertString(Scheduler.Instance.GetTimeTilNextAppt(this), 1, TimeUnit.FIT)));
continue;
}
double mult = _interval / 3600000d;
double petLevel = 0;
double clanAge = 0;
ClanInfo clan = Clans().CUtil().getClanByPlayer(cur);
if (clan != null) clanAge = (System.currentTimeMillis() - clan.GetDateCreated()) / 86400000d;
if (clanAge > 7)
clanAge = 7;
int NACPoints = 0;
if (Clients().Get(cur).NAC().IsUsing())
NACPoints = (int) (_pphNAC * mult);
int clanPoints = (int) (mult * _pphOnlineClan * clanAge);
int petPoints = (int) (mult * _pphOnlinePet * petLevel);
int onlinePoints = (int) (mult * _pphOnline);
int totalPoints = clanPoints + petPoints + NACPoints + onlinePoints;
boolean hitCap = false;
if (totalPoints == 0)
continue;
else if (totalPoints + _pointTotals.get(cur.getName()) > _maxPPH)
{
hitCap = true;
totalPoints = _maxPPH - _pointTotals.get(cur.getName());
}
UtilPlayer.message(cur, "§a§lOnline Point Reward - " + UtilTime.convertString(_interval, 1, TimeUnit.FIT));
UtilPlayer.message(cur, F.value("Online", onlinePoints + " Points"));
UtilPlayer.message(cur, F.value("NAC User", NACPoints + " Points"));
UtilPlayer.message(cur, F.value("Clan Age", clanPoints + " Points"));
UtilPlayer.message(cur, F.value("Battle Pet", petPoints + " Points"));
UtilPlayer.message(cur, "You received " + F.count(totalPoints + " Points") + ".");
if (hitCap)
{
UtilPlayer.message(cur, "§c§lYou have already earned the max of " + _maxPPH + " Points today.");
UtilPlayer.message(cur, F.value("You will earn more in:", UtilTime.convertString(Scheduler.Instance.GetTimeTilNextAppt(this), 1, TimeUnit.FIT)));
}
//Effect
cur.playSound(cur.getLocation(), Sound.LEVEL_UP, 1f, 2f);
//Give Points
PlayerUpdateToken token = new PlayerUpdateToken();
token.Name = cur.getName();
token.Points = totalPoints;
Repository.PlayerUpdate(null, token);
_pointTotals.put(cur.getName(), _pointTotals.get(cur.getName()) + totalPoints);
}
}
private long ReadQuit(String name)
{
long quitTime = System.currentTimeMillis();
FileInputStream fstream = null;
DataInputStream in = null;
BufferedReader br = null;
try
{
File f = new File(_folder + name + ".dat");
if (!f.exists())
return quitTime;
fstream = new FileInputStream(f);
in = new DataInputStream(fstream);
br = new BufferedReader(new InputStreamReader(in));
String strLine = br.readLine();
try
{
quitTime = Long.parseLong(strLine);
}
catch (Exception e)
{
}
}
catch (Exception e)
{
System.err.println("Build Read Error: " + e.getMessage());
}
finally
{
if (br != null)
{
try
{
br.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
if (in != null)
{
try
{
in.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
if (fstream != null)
{
try
{
fstream.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
return quitTime;
}
private void WriteQuit(String name)
{
FileWriter fstream = null;
BufferedWriter out = null;
try
{
fstream = new FileWriter(_folder + name + ".dat");
out = new BufferedWriter(fstream);
out.write("" + System.currentTimeMillis());
out.close();
}
catch (Exception e)
{
System.err.println("PPH Write Error: " + e.getMessage());
}
finally
{
if (out != null)
{
try
{
out.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
if (fstream != null)
{
try
{
fstream.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
}
@Override
public void AppointmentFire()
{
_pointTotals.clear();
}
}

View File

@ -1,419 +0,0 @@
package me.chiss.Core.Modules;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import me.chiss.Core.Clans.ClansClan;
import me.chiss.Core.Clans.ClansUtility.ClanRelation;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import me.chiss.Core.Module.AModule;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class Quit extends AModule
{
//Config
private int _logTime = 10;
private long _rejoinTime = 60000;
//Track Offline Players
private HashMap<Player, QuitDataLog> _logMap = new HashMap<Player, QuitDataLog>();
private HashMap<String, QuitDataQuit> _quitMap = new HashMap<String, QuitDataQuit>();
private HashSet<String> _clearSet = new HashSet<String>();
public Quit(JavaPlugin plugin)
{
super("Quit", plugin);
}
//Module Functions
@Override
public void enable()
{
}
@Override
public void disable()
{
}
@Override
public void config()
{
}
@Override
public void commands()
{
AddCommand("log");
AddCommand("quit");
}
@Override
public void command(Player caller, String cmd, String[] args)
{
if (!checkItems(caller))
return;
if (!checkLand(caller))
return;
if (!checkWar(caller))
return;
//Set
_logMap.put(caller, new QuitDataLog(_logTime, caller.getLocation()));
//Inform
UtilPlayer.message(caller, F.main(GetName(), "Logging out in " +
F.time(_logTime + " Seconds") +
"."));
}
@EventHandler
public void Join(PlayerJoinEvent event)
{
if (_clearSet.remove(event.getPlayer().getName()))
UtilInv.Clear(event.getPlayer());
QuitDataQuit quit = _quitMap.get(event.getPlayer().getName());
//Set
if (quit != null)
{
quit.SetOffline(false);
Condition().Factory().Silence("Unsafe Log", event.getPlayer(), event.getPlayer(), 10, false, true);
Condition().Factory().Weakness("Unsafe Log", event.getPlayer(), event.getPlayer(), 10, 3, false, true);
Condition().Factory().Slow("Unsafe Log", event.getPlayer(), event.getPlayer(), 10, 3, false, true, false);
}
//Message
if (quit != null) event.setJoinMessage(F.sys("Join", event.getPlayer().getName() + C.sysHead + " (" + C.cGreen + "Recover" + C.sysHead + ")"));
else event.setJoinMessage(F.sys("Join", event.getPlayer().getName()));
//Log
System.out.println("Client Join [" + event.getPlayer().getName() + "] with Recovery [" + (quit != null) + "].");
}
public void AddQuit(Player player)
{
if (!_quitMap.containsKey(player.getName()))
{
_quitMap.put(player.getName(), new QuitDataQuit(player));
}
else
{
if (_quitMap.get(player.getName()).SetOffline(true))
{
final Player punish = player;
_plugin.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable()
{
public void run()
{
Punish(punish.getName());
}
}, 0);
}
}
}
@EventHandler
public void Kick(PlayerKickEvent event)
{
QuitDataLog data = _logMap.get(event.getPlayer());
boolean safe = false;
if (data != null)
safe = data.GetLogTime() == 0;
if (event.getPlayer().isDead())
safe = true;
if (!safe)
{
boolean clear = false;
for (Player other : event.getPlayer().getWorld().getPlayers())
if (UtilMath.offset(event.getPlayer(), other) < 32)
if (Clans().canHurt(event.getPlayer(), other))
clear = true;
if (!clear)
safe = true;
}
int number = 1;
if (_quitMap.containsKey(event.getPlayer().getName()))
number = _quitMap.get(event.getPlayer().getName()).GetCount() + 1;
//String
String type = C.sysHead + " (" + C.cRed + "Unsafe " + number + "/3" + C.sysHead + ")";
if (safe) type = C.sysHead + " (" + C.cGreen + "Safe" + C.sysHead + ")";
//DONT DO STUFF
//Message
event.setLeaveMessage(F.sys("Quit", event.getPlayer().getName() + type));
//Log
System.out.println("Client Kick [" + event.getPlayer().getName() + "] with Safe [" + safe + "].");
}
@EventHandler
public void Quits(PlayerQuitEvent event)
{
Player player = event.getPlayer();
QuitDataLog data = _logMap.remove(player);
boolean safe = false;
if (data != null)
safe = data.GetLogTime() == 0;
if (player.isDead())
safe = true;
if (!safe)
{
boolean clear = false;
for (Player other : player.getWorld().getPlayers())
if (UtilMath.offset(player, other) < 32)
if (Clans().canHurt(player, other))
clear = true;
if (!clear)
safe = true;
}
//Combat Log
if (!player.isDead() &&
(!UtilTime.elapsed(Clients().Get(player).Player().GetLastDamagee(), 15000) ||
!UtilTime.elapsed(Clients().Get(player).Player().GetLastDamager(), 15000)))
{
//String
String type = C.sysHead + " (" + C.cRed + "Combat Log" + C.sysHead + ")";
AddQuit(player);
//Message
event.setQuitMessage(F.sys("Quit", player.getName() + type));
//Log
System.out.println("Client Quit [" + player.getName() + "] with Safe [" + "Combat Log" + "].");
}
//Unsafe Log
else
{
int number = 1;
if (_quitMap.containsKey(player.getName()))
number = _quitMap.get(player.getName()).GetCount() + 1;
//String
String type = C.sysHead + " (" + C.cRed + "Unsafe " + number + "/3" + C.sysHead + ")";
if (safe) type = C.sysHead + " (" + C.cGreen + "Safe" + C.sysHead + ")";
if (!safe) AddQuit(player);
else _quitMap.remove(player.getName());
//Message
event.setQuitMessage(F.sys("Quit", player.getName() + type));
//Log
System.out.println("Client Quit [" + player.getName() + "] with Safe [" + safe + "].");
}
}
@EventHandler
public void Interact(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
//Inform
if (_logMap.remove(event.getPlayer()) != null)
UtilPlayer.message(event.getPlayer(), F.main(GetName(), "Log cancelled due to action."));
}
@EventHandler(priority = EventPriority.MONITOR)
public void Damage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
//Take Damage
if (!(event.GetDamageeEntity() instanceof Player))
return;
Player damagee = (Player)event.GetDamageeEntity();
//Inform
if (_logMap.remove(damagee) != null)
UtilPlayer.message(damagee, F.main(GetName(), "Log cancelled due to damage."));
}
@EventHandler
public void Pickup(PlayerPickupItemEvent event)
{
if (event.isCancelled())
return;
if (_logMap.containsKey(event.getPlayer()))
event.setCancelled(true);
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() == UpdateType.FAST)
updateQuit();
if (event.getType() == UpdateType.TICK)
updateLog();
}
public void updateLog()
{
for (Iterator<Player> i = _logMap.keySet().iterator(); i.hasNext();)
{
Player cur = i.next();
QuitDataLog log = _logMap.get(cur);
if (!UtilTime.elapsed(log.GetLogLast(), 1000))
continue;
//Set
log.SetLogTime(log.GetLogTime() - 1);
log.SetLogLast(System.currentTimeMillis());
//Safely Log
if (log.GetLogTime() == 0)
{
UtilPlayer.kick(cur, GetName(), "Safely Logged Out", false);
i.remove();
continue;
}
//Other
if (UtilMath.offset(log.GetLogLoc(), cur.getLocation()) > 0.5)
{
//Inform
UtilPlayer.message(cur, F.main(GetName(), "Log cancelled due to movement."));
i.remove();
}
else
{
//Inform
UtilPlayer.message(cur, F.main(GetName(), "Logging out in " +
F.time(log.GetLogTime() + " Seconds") +
"."));
}
}
}
public void updateQuit()
{
HashSet<String> expired = new HashSet<String>();
HashSet<String> punish = new HashSet<String>();
for (String cur : _quitMap.keySet())
{
QuitDataQuit quit = _quitMap.get(cur);
if (!UtilTime.elapsed(quit.GetQuitTime(), _rejoinTime))
continue;
//Online and Expired
if (!quit.IsOffline())
{
expired.add(cur);
continue;
}
//Done
punish.add(cur);
}
for (String cur : punish)
Punish(cur);
for (String cur : expired)
{
_quitMap.remove(cur);
System.out.println("Expired [" + cur + "] for staying online.");
}
}
public void Punish(String cur)
{
Player player = _quitMap.remove(cur).GetPlayer();
//Inform
for (Player other : UtilServer.getPlayers())
UtilPlayer.message(other, F.main("Log",
F.name(player.getName()) +
C.cGray + " dropped inventory for unsafe logging."));
//Log
System.out.println("Punished [" + cur + "] for unsafe logging.");
//Drop Inventory
UtilInv.drop(player, true);
//
_clearSet.add(player.getName());
}
public boolean checkLand(Player caller)
{
if (Clans().CUtil().getAccess(caller, caller.getLocation()) == ClanRelation.NEUTRAL &&
!Clans().CUtil().isAdmin(caller.getLocation()))
{
UtilPlayer.message(caller, F.main(GetName(), "You cannot log in enemy territory."));
return false;
}
return true;
}
public boolean checkWar(Player caller)
{
ClansClan clan = Clans().CUtil().getClanByPlayer(caller);
if (clan == null)
return true;
if (clan.GetEnemyEvent().isEmpty())
return true;
UtilPlayer.message(caller, F.main(GetName(), "You cannot log during invasion event."));
return false;
}
public boolean checkItems(Player player)
{
return (new QuitInventory(this)).Check(player);
}
}

View File

@ -1,42 +0,0 @@
package me.chiss.Core.Modules;
import org.bukkit.Location;
public class QuitDataLog
{
//Log Timer
private int _logTime = 0;
private long _logLast = 0;
private Location _logLoc = null;
public QuitDataLog(int time, Location loc)
{
_logTime = time;
_logLast = System.currentTimeMillis();
_logLoc = loc;
}
public int GetLogTime() {
return _logTime;
}
public void SetLogTime(int _logTime) {
this._logTime = _logTime;
}
public long GetLogLast() {
return _logLast;
}
public void SetLogLast(long _logLast) {
this._logLast = _logLast;
}
public Location GetLogLoc() {
return _logLoc;
}
public void SetLogLoc(Location _logLoc) {
this._logLoc = _logLoc;
}
}

View File

@ -1,62 +0,0 @@
package me.chiss.Core.Modules;
import org.bukkit.entity.Player;
public class QuitDataQuit
{
//Quit
private boolean _offline = false;
private long _quitTime = 0;
private int _quitCount = 0;
private Player _player = null;
public QuitDataQuit(Player player)
{
SetOffline(true);
SetPlayer(player);
_quitTime = System.currentTimeMillis();
}
public long GetQuitTime() {
return _quitTime;
}
public void SetQuitTime(long _quitTime) {
this._quitTime = _quitTime;
}
public boolean IsOffline() {
return _offline;
}
public boolean SetOffline(boolean offline)
{
this._offline = offline;
_quitTime = System.currentTimeMillis();
if (offline)
{
_quitCount++;
if (_quitCount >= 3)
return true;
}
return false;
}
public int GetCount()
{
return _quitCount;
}
public Player GetPlayer() {
return _player;
}
public void SetPlayer(Player _quitRef) {
this._player = _quitRef;
}
}

View File

@ -1,272 +0,0 @@
package me.chiss.Core.Modules;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
public class QuitInventory
{
//Quit Limits
public int[] limSword = new int[] {3, 0};
public int[] limSwordEnch = new int[] {12, 0};
public int[] limAxe = new int[] {3, 0};
public int[] limAxeEnch = new int[] {12, 0};
public int[] limBow = new int[] {2, 0};
public int[] limBowEnch = new int[] {8, 0};;
public int[] limBowArrow = new int[] {128, 0};
public int[] limHelm = new int[] {3, 0};
public int[] limHelmEnch = new int[] {8, 0};
public int[] limChest = new int[] {3, 0};
public int[] limChestEnch = new int[] {8, 0};
public int[] limLeg = new int[] {3, 0};
public int[] limLegEnch = new int[] {8, 0};
public int[] limBoot = new int[] {3, 0};
public int[] limBootEnch = new int[] {8, 0};
public int[] limTNT = new int[] {8, 0};
public int[] limMaterial = new int[] {128, 0};
public int[] limEmerald = new int[] {64, 0};
private Quit Quit;
public QuitInventory(Quit quit)
{
Quit = quit;
}
public int CountEnch(ItemStack stack)
{
int count = 0;
for (int cur : stack.getEnchantments().values())
count += cur;
return count;
}
public boolean Check(Player player)
{
PlayerInventory inv = player.getInventory();
for (ItemStack cur : inv.getContents())
{
if (cur == null) continue;
if (cur.getType() == Material.AIR) continue;
//Sword
if (cur.getType() == Material.IRON_SWORD) { limSword[1]++; limSwordEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.GOLD_SWORD) { limSword[1]++; limSwordEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.DIAMOND_SWORD) { limSword[1]++; limSwordEnch[1] += CountEnch(cur); }
//Axe
else if (cur.getType() == Material.IRON_AXE) { limAxe[1]++; limAxeEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.GOLD_AXE) { limAxe[1]++; limAxeEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.DIAMOND_AXE) { limSword[1]++; limSwordEnch[1] += CountEnch(cur); }
//Bow
else if (cur.getType() == Material.BOW) { limBow[1]++; limBowEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.ARROW) { limBowArrow[1] += cur.getAmount();}
//Helm
else if (cur.getType() == Material.IRON_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.GOLD_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.DIAMOND_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.LEATHER_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.CHAINMAIL_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); }
//Chest
else if (cur.getType() == Material.IRON_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.GOLD_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.DIAMOND_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.LEATHER_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.CHAINMAIL_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); }
//Leg
else if (cur.getType() == Material.IRON_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.GOLD_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.DIAMOND_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.LEATHER_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.CHAINMAIL_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); }
//Boot
else if (cur.getType() == Material.IRON_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.GOLD_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.DIAMOND_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.LEATHER_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.CHAINMAIL_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); }
//Items
else if (cur.getType() == Material.TNT) { limTNT[1]++;}
else if (cur.getType() == Material.IRON_ORE) { limMaterial[1]++;}
else if (cur.getType() == Material.IRON_INGOT) { limMaterial[1]++;}
else if (cur.getType() == Material.IRON_BLOCK) { limMaterial[1] += 9;}
else if (cur.getType() == Material.GOLD_ORE) { limMaterial[1]++;}
else if (cur.getType() == Material.GOLD_INGOT) { limMaterial[1]++;}
else if (cur.getType() == Material.GOLD_BLOCK) { limMaterial[1] += 9;}
else if (cur.getType() == Material.DIAMOND) { limMaterial[1]++;}
else if (cur.getType() == Material.DIAMOND_BLOCK) { limMaterial[1] += 9;}
else if (cur.getType() == Material.LEATHER) { limMaterial[1]++;}
else if (cur.getType() == Material.EMERALD) { limEmerald[1]++;}
else if (cur.getType() == Material.EMERALD_BLOCK) { limEmerald[1] += 9;}
}
for (ItemStack cur : inv.getArmorContents())
{
if (cur == null) continue;
if (cur.getType() == Material.AIR) continue;
//Helm
if (cur.getType() == Material.IRON_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.GOLD_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.DIAMOND_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.LEATHER_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.CHAINMAIL_HELMET) { limHelm[1]++; limHelmEnch[1] += CountEnch(cur); }
//Chest
else if (cur.getType() == Material.IRON_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.GOLD_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.DIAMOND_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.LEATHER_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.CHAINMAIL_CHESTPLATE) { limChest[1]++; limChestEnch[1] += CountEnch(cur); }
//Leg
else if (cur.getType() == Material.IRON_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.GOLD_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.DIAMOND_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.LEATHER_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.CHAINMAIL_LEGGINGS) { limLeg[1]++; limLegEnch[1] += CountEnch(cur); }
//Boot
else if (cur.getType() == Material.IRON_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.GOLD_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.DIAMOND_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.LEATHER_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); }
else if (cur.getType() == Material.CHAINMAIL_BOOTS) { limBoot[1]++; limBootEnch[1] += CountEnch(cur); }
}
boolean valid = true;
//Weapons
if (limSword[1] > limSword[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Swords [" + limSword[1] + "/" + limSword[0] + "]."));
valid = false;
}
if (limSwordEnch[1] > limSwordEnch[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Sword Enchantments [" + limSwordEnch[1] + "/" + limSwordEnch[0] + "]."));
valid = false;
}
if (limAxe[1] > limAxe[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Axes [" + limAxe[1] + "/" + limAxe[0] + "]."));
valid = false;
}
if (limAxeEnch[1] > limAxeEnch[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Axe Enchantments [" + limAxeEnch[1] + "/" + limAxeEnch[0] + "]."));
valid = false;
}
if (limBow[1] > limBow[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Bows [" + limBow[1] + "/" + limBow[0] + "]."));
valid = false;
}
if (limBowEnch[1] > limBowEnch[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Bow Enchantments [" + limBowEnch[1] + "/" + limBowEnch[0] + "]."));
valid = false;
}
if (limBowArrow[1] > limBowArrow[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Arrows [" + limBowArrow[1] + "/" + limBowArrow[0] + "]."));
valid = false;
}
//Armor
if (limHelm[1] > limHelm[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Helmets [" + limHelm[1] + "/" + limHelm[0] + "]."));
valid = false;
}
if (limHelmEnch[1] > limHelmEnch[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Helmet Enchantments [" + limHelmEnch[1] + "/" + limHelmEnch[0] + "]."));
valid = false;
}
if (limChest[1] > limChest[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Chestplates [" + limChest[1] + "/" + limChest[0] + "]."));
valid = false;
}
if (limChestEnch[1] > limChestEnch[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Chestplate Enchantments [" + limChestEnch[1] + "/" + limChestEnch[0] + "]."));
valid = false;
}
if (limLeg[1] > limLeg[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Leggings [" + limLeg[1] + "/" + limLeg[0] + "]."));
valid = false;
}
if (limLegEnch[1] > limLegEnch[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Legging Enchantments [" + limLegEnch[1] + "/" + limLegEnch[0] + "]."));
valid = false;
}
if (limBoot[1] > limBoot[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Boots [" + limBoot[1] + "/" + limBoot[0] + "]."));
valid = false;
}
if (limBootEnch[1] > limBootEnch[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Boot Enchantments [" + limBootEnch[1] + "/" + limBootEnch[0] + "]."));
valid = false;
}
//Items
if (limTNT[1] > limTNT[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too much TNT [" + limTNT[1] + "/" + limTNT[0] + "]."));
valid = false;
}
if (limMaterial[1] > limMaterial[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too much Ore/Material [" + limMaterial[1] + "/" + limMaterial[0] + "]."));
valid = false;
}
if (limEmerald[1] > limEmerald[0])
{
UtilPlayer.message(player, F.main(Quit.GetName(), "You have too many Emeralds [" + limEmerald[1] + "/" + limEmerald[0] + "]."));
valid = false;
}
return valid;
}
}

View File

@ -1,465 +0,0 @@
package me.chiss.Core.Modules;
import java.util.HashMap;
import java.util.HashSet;
import me.chiss.Core.Module.AModule;
import mineplex.core.common.Rank;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.fakeEntity.FakeEntity;
import mineplex.core.fakeEntity.FakeEntityManager;
import mineplex.core.fakeEntity.FakePlayer;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import net.minecraft.server.v1_7_R4.EntityInsentient;
import net.minecraft.server.v1_7_R4.EntityLiving;
import net.minecraft.server.v1_7_R4.EntityPlayer;
import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R4.Packet28EntityVelocity;
import net.minecraft.server.v1_7_R4.Packet31RelEntityMove;
import net.minecraft.server.v1_7_R4.Packet34EntityTeleport;
import net.minecraft.server.v1_7_R4.PathfinderGoalSelector;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftAgeable;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
public class Tester extends AModule
{
private HashMap<Player, HashSet<String>> _test = new HashMap<Player, HashSet<String>>();
private HashMap<Player, Vector> _speed = new HashMap<Player, Vector>();
private HashMap<Player, Double> _speedVert = new HashMap<Player, Double>();
public Tester(JavaPlugin plugin)
{
super("Tester", plugin);
}
//Module Functions
@Override
public void enable()
{
}
@Override
public void disable()
{
}
@Override
public void config()
{
}
@Override
public void commands()
{
AddCommand("e1");
AddCommand("spleef");
AddCommand("coinset");
AddCommand("sin");
AddCommand("wi");
AddCommand("arraylist");
AddCommand("spinme");
AddCommand("karts");
AddCommand("blocks");
AddCommand("testi");
AddCommand("flag");
}
@Override
public void command(Player caller, String cmd, String[] args)
{
if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true))
return;
if (cmd.equals("coinset"))
{
Clients().Get(caller).Game().SetEconomyBalance(100000);
}
if (cmd.equals("sin"))
{
try
{
double a = Double.parseDouble(args[0]);
caller.sendMessage("sin(" + a + ") = " + Math.sin(a));
}
catch (Exception e)
{
}
}
if (!_test.containsKey(caller))
_test.put(caller, new HashSet<String>());
if (cmd.equals("e1"))
{
if (!_test.get(caller).remove("e1"))
_test.get(caller).add("e1");
caller.sendMessage("Toggled E1");
}
if (cmd.equals("wi"))
{
caller.sendMessage("Block: " + caller.getLocation().getBlock().getTypeId() + ":" + caller.getLocation().getBlock().getData());
}
if (cmd.equals("arraylist"))
{
}
if (cmd.equals("spinme"))
{
SpinHim(caller);
}
if (cmd.equals("karts"))
{
ShowPlayersInKarts();
}
if (cmd.equals("testi"))
{
ShowBobInvis(caller);
}
if (cmd.equals("flag"))
{
TestFlag(caller);
}
if (cmd.equals("fakepig"))
{
ShowFakePig(caller);
}
if (cmd.equals("fakeperson"))
{
ShowRealPig(caller);
}
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : _test.keySet())
if (_test.get(cur).contains("e1"))
cur.getWorld().playEffect(cur.getLocation().add(0, 2, 0), Effect.ENDER_SIGNAL, 0);
}
@EventHandler
public void Spleef(PlayerInteractEvent event)
{
if (!event.getPlayer().getName().equals("Chiss"))
return;
if (event.getClickedBlock() == null)
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (event.getPlayer().getItemInHand().getType() != Material.BOWL)
return;
event.getPlayer().sendMessage("Light Level: " + event.getClickedBlock().getLightFromSky());
}
public Vector GetSpeed(Player player)
{
if (!_speed.containsKey(player))
_speed.put(player, new Vector(0,0,0));
return _speed.get(player);
}
public double GetSpeedVert(Player player)
{
if (!_speedVert.containsKey(player))
_speedVert.put(player, 0d);
return _speedVert.get(player);
}
public void ShowBobInvis(Player player)
{
final EntityPlayer mcPlayer = ((CraftPlayer)player).getHandle();
final FakePlayer fakePlayer = new FakePlayer("BOB", player.getEyeLocation().add(1, 0, -3));
mcPlayer.playerConnection.sendPacket(fakePlayer.Spawn());
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable()
{
public void run()
{
mcPlayer.playerConnection.sendPacket(fakePlayer.Hide());
System.out.println("Sent meta packet");
}
}, 20L);
}
public void ShowFakePig(Player player)
{
FakeEntity entity = new FakeEntity(EntityType.PIG, player.getLocation());
final EntityPlayer mcPlayer = ((CraftPlayer)player).getHandle();
mcPlayer.playerConnection.sendPacket(entity.Spawn());
mcPlayer.playerConnection.sendPacket(new Packet28EntityVelocity(entity.GetEntityId(), 100, 0, 0));
}
public void ShowRealPig(Player player)
{
FakePlayer fakePlayer = new FakePlayer(player.getName() + "1", player.getLocation());
final EntityPlayer mcPlayer = ((CraftPlayer)player).getHandle();
mcPlayer.playerConnection.sendPacket(fakePlayer.Spawn());
mcPlayer.playerConnection.sendPacket(new Packet28EntityVelocity(fakePlayer.GetEntityId(), 10000, 0, 0));
}
public void ShowPlayersInKarts()
{
for (Player player : Bukkit.getOnlinePlayers())
{
FakeEntity entity = new FakeEntity(EntityType.PIG, player.getLocation());
for (Player otherPlayer : Bukkit.getOnlinePlayers())
{
if (player == otherPlayer)
continue;
final EntityPlayer mcPlayer = ((CraftPlayer)otherPlayer).getHandle();
mcPlayer.playerConnection.sendPacket(entity.Spawn());
mcPlayer.playerConnection.sendPacket(entity.SetPassenger(player.getEntityId()));
FakeEntityManager.Instance.ForwardMovement(otherPlayer, player, entity.GetEntityId());
}
}
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable()
{
public void run()
{
for (Player player : Bukkit.getOnlinePlayers())
{
Location location = player.getLocation();
Packet34EntityTeleport teleportPacket = new Packet34EntityTeleport(player.getEntityId(), MathHelper.floor(location.getX() * 32.0D), MathHelper.floor(location.getY() * 32.0D), MathHelper.floor(location.getZ() * 32.0D), (byte) ((int) (MathHelper.d(location.getYaw() * 256.0F / 360.0F))), (byte) ((int) (MathHelper.d(location.getPitch() * 256.0F / 360.0F))));
for (Player otherPlayer : Bukkit.getOnlinePlayers())
{
final EntityPlayer mcPlayer = ((CraftPlayer)otherPlayer).getHandle();
if (player == otherPlayer)
continue;
mcPlayer.playerConnection.sendPacket(teleportPacket);
}
}
}
}, 0L, 40L);
/*
for (Player player : Bukkit.getOnlinePlayers())
{
FakeEntity entity = new FakeEntity(EntityType.PIG, player.getLocation());
FakePlayer fakePlayer = new FakePlayer(player.getName(), player.getLocation().subtract(new Vector(0, 1, 0)));
//Entity kart = player.getWorld().spawnEntity(player.getLocation(), EntityType.PIG);
for (Player otherPlayer : Bukkit.getOnlinePlayers())
{
final EntityPlayer mcPlayer = ((CraftPlayer)otherPlayer).getHandle();
if (player == otherPlayer)
{
// mcPlayer.playerConnection.sendPacket(fakePlayer.Hide(kart.getEntityId()));
continue;
}
mcPlayer.playerConnection.sendPacket(fakePlayer.Spawn());
mcPlayer.playerConnection.sendPacket(entity.Spawn());
mcPlayer.playerConnection.sendPacket(fakePlayer.SetPassenger(entity.GetEntityId()));
mcPlayer.playerConnection.sendPacket(entity.SetPassenger(player.getEntityId()));
mcPlayer.playerConnection.sendPacket(fakePlayer.Hide());
FakeEntityManager.Instance.ForwardMovement(otherPlayer, player, fakePlayer.GetEntityId());
//FakeEntityManager.Instance.BlockMovement(otherPlayer, kart.getEntityId());
}
}
*/
}
public void TestFlag(final Player player)
{
final EntityPlayer mcPlayer = ((CraftPlayer)player).getHandle();
for (final Player onlinePlayer : Bukkit.getOnlinePlayers())
{
if (onlinePlayer == player)
continue;
final Item anchor = player.getWorld().dropItem(onlinePlayer.getEyeLocation(), new ItemStack(Material.WOOL.getId(), 1, (byte)11));
Item flag12 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(0, 1, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)12));
Item flag13 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(0, 2, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)13));
Item flag14 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(0, 2, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)14));
Item flag15 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(0, 4, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)15));
anchor.setPassenger(flag12);
flag12.setPassenger(flag13);
flag13.setPassenger(flag14);
flag14.setPassenger(flag15);
anchor.setPickupDelay(600);
flag12.setPickupDelay(600);
flag13.setPickupDelay(600);
flag14.setPickupDelay(600);
flag15.setPickupDelay(600);
final Item anchor2 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(1, 1, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)0));
Item flag22 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(1, 2, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)1));
Item flag23 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(1, 3, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)2));
Item flag24 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(1, 4, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)3));
anchor2.setPassenger(flag22);
flag22.setPassenger(flag23);
flag23.setPassenger(flag24);
anchor2.setPickupDelay(600);
flag22.setPickupDelay(600);
flag23.setPickupDelay(600);
flag24.setPickupDelay(600);
final Item anchor3 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(2, 1, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)4));
Item flag32 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(2, 2, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)5));
Item flag33 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(2, 3, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)6));
Item flag34 = player.getWorld().dropItem(onlinePlayer.getEyeLocation().add(2, 4, 0), new ItemStack(Material.WOOL.getId(), 1, (byte)7));
anchor3.setPassenger(flag32);
flag32.setPassenger(flag33);
flag33.setPassenger(flag34);
anchor3.setPickupDelay(600);
flag32.setPickupDelay(600);
flag33.setPickupDelay(600);
flag34.setPickupDelay(600);
onlinePlayer.setPassenger(anchor);
final FakePlayer fakePlayer = new FakePlayer("test", onlinePlayer.getLocation().add(1, 0, 0));
final FakePlayer fakePlayer2 = new FakePlayer("test2", onlinePlayer.getLocation().add(2, 0, 0));
mcPlayer.playerConnection.sendPacket(fakePlayer.Spawn());
mcPlayer.playerConnection.sendPacket(fakePlayer.Hide());
mcPlayer.playerConnection.sendPacket(fakePlayer2.Spawn());
mcPlayer.playerConnection.sendPacket(fakePlayer2.Hide());
mcPlayer.playerConnection.sendPacket(fakePlayer.SetPassenger(anchor2.getEntityId()));
mcPlayer.playerConnection.sendPacket(fakePlayer2.SetPassenger(anchor3.getEntityId()));
for (int i=0; i < 101; i++)
{
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable()
{
public void run()
{
Vector player1 = UtilAlg.getTrajectory(fakePlayer.GetLocation().toVector(), onlinePlayer.getLocation().toVector().subtract(new Vector(1, 0, 0)));
Vector player2 = UtilAlg.getTrajectory(fakePlayer2.GetLocation().toVector(), onlinePlayer.getLocation().toVector().subtract(new Vector(2, 0, 0)));
player1.multiply(20);
player2.multiply(20);
mcPlayer.playerConnection.sendPacket(new Packet31RelEntityMove(fakePlayer.GetEntityId(), (byte)player1.getX(), (byte)player1.getY(), (byte)player1.getZ()));
mcPlayer.playerConnection.sendPacket(new Packet31RelEntityMove(fakePlayer2.GetEntityId(), (byte)player2.getX(), (byte)player2.getY(), (byte)player2.getZ()));
fakePlayer.SetLocation(onlinePlayer.getLocation().subtract(new Vector(1, 0, 0)));
fakePlayer2.SetLocation(onlinePlayer.getLocation().subtract(new Vector(2, 0, 0)));
}
}, i + 1);
}
}
}
public void SpinHim(final Player player)
{
Entity entity = player.getWorld().spawnEntity(player.getLocation(), EntityType.OCELOT);
((CraftAgeable)entity).setBaby();
((CraftAgeable)entity).setAgeLock(true);
try
{
java.lang.reflect.Field _goalSelector = EntityInsentient.class.getDeclaredField("goalSelector");
_goalSelector.setAccessible(true);
java.lang.reflect.Field _targetSelector = EntityInsentient.class.getDeclaredField("targetSelector");
_targetSelector.setAccessible(true);
_goalSelector.set(((CraftLivingEntity)entity).getHandle(), new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler));
_targetSelector.set(((CraftLivingEntity)entity).getHandle(), new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler));
}
catch (IllegalArgumentException e)
{
e.printStackTrace();
}
catch (IllegalAccessException e)
{
e.printStackTrace();
}
catch (NoSuchFieldException e)
{
e.printStackTrace();
}
catch (SecurityException e)
{
e.printStackTrace();
}
entity.setPassenger(player);
final Entity newEntity = entity;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable()
{
public void run()
{
((CraftEntity)newEntity).getHandle().yaw = ((CraftEntity)newEntity).getHandle().yaw + 179;
}
}, 20L);
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable()
{
public void run()
{
player.leaveVehicle();
newEntity.remove();
}
}, 110L);
}
}

View File

@ -1,97 +0,0 @@
package me.chiss.Core.Modules;
import java.util.Arrays;
import java.util.List;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.fakeEntity.FakeEntity;
import net.minecraft.server.v1_7_R4.EntityPlayer;
import net.minecraft.server.v1_7_R4.Packet28EntityVelocity;
public class UpdateThread extends Thread
{
private EntityPlayer _player;
private List<FakeEntity> _entities;
private int counter = 0;
public UpdateThread(EntityPlayer mcPlayer, FakeEntity...entities)
{
_player = mcPlayer;
_entities = Arrays.asList(entities);
}
public void run()
{
int incrementer = 1;
while (counter >= 0)
{
int i = 0;
for (FakeEntity item : _entities)
{
double radialLead = i * ((2d * Math.PI)/3);
i++;
Vector desiredA = GetTarget(_player.locX, _player.locY, _player.locZ, counter, radialLead);
//Vector desiredB = GetTarget(_player.locX, _player.locY, _player.locZ, counter, radialLead + 1);
//double distA = UtilMath.offset(item.GetLocation().toVector(), desiredA);
//double distB = UtilMath.offset(item.GetLocation().toVector(), desiredB);
//double distAB = UtilMath.offset(desiredA, desiredB);
//if (distA > distB)
// continue;
//if (distA < distAB / 2)
// continue;
Vector vel = UtilAlg.getTrajectory(item.GetLocation().toVector(), desiredA);
vel = vel.normalize();
// Player
//vel = vel.multiply(2);
//_player.playerConnection.sendPacket(new Packet31RelEntityMove(item.GetEntityId(), (byte)(incrementer + vel.getX()), (byte)vel.getY(), (byte)(incrementer + vel.getZ())));
// Ghast
vel = vel.multiply(.08);
//vel = vel.add(FakeEntityManager.Instance.GetKartVelocity());
_player.playerConnection.sendPacket(new Packet28EntityVelocity(item.GetEntityId(), vel.getX(), vel.getY(), vel.getZ()));
item.SetLocation(item.GetLocation().add(vel));
if (counter % 20 == 0)
{
//_player.playerConnection.sendPacket(new Packet34EntityTeleport(item.GetEntityId(), (int)(desiredA.getX() / 1.6), (int)desiredA.getY(), (int)(desiredA.getZ() / 1.6), (byte)0, (byte)0));
}
}
if (counter == 200)
incrementer = -1;
counter += incrementer;
try
{
Thread.sleep(50);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}
public static Vector GetTarget(double originX, double originY, double originZ, int tick, double radialLead)
{
//Orbit
double speed = 10d;
double oX = Math.sin(tick/speed + radialLead) * 1.5;
double oY = 0.5;
double oZ = Math.cos(tick/speed + radialLead) * 1.5;
return new Vector(originX + oX, originY + oY, originZ + oZ);
}
}

View File

@ -1,92 +0,0 @@
package me.chiss.Core.Modules;
import org.bukkit.plugin.java.JavaPlugin;
import me.chiss.Core.Module.AModule;
import me.chiss.Core.Utility.*;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
public class Utility extends AModule
{
public Utility(JavaPlugin plugin)
{
super("Utility", plugin);
}
@Override
public void enable()
{
}
@Override
public void disable()
{
}
@Override
public void config()
{
}
@Override
public void commands()
{
}
@Override
public void command(org.bukkit.entity.Player caller, String cmd, String[] args)
{
}
private UtilAccount _utilAccount;
private UtilEvent _utilEvent;
private UtilGear _utilGear;
private UtilInput _utilInput;
private UtilItem _utilItem;
public UtilAccount Acc()
{
if (_utilAccount == null)
_utilAccount = new UtilAccount(this);
return _utilAccount;
}
public UtilEvent Event()
{
if (_utilEvent == null)
_utilEvent = new UtilEvent(this);
return _utilEvent;
}
public UtilGear Gear()
{
if (_utilGear == null)
_utilGear = new UtilGear(this);
return _utilGear;
}
public UtilInput Input()
{
if (_utilInput == null)
_utilInput = new UtilInput(this);
return _utilInput;
}
public UtilItem Items()
{
if (_utilItem == null)
_utilItem = new UtilItem(this);
return _utilItem;
}
}

View File

@ -1,308 +0,0 @@
package me.chiss.Core.Modules;
import java.util.HashMap;
import java.util.LinkedList;
import org.bukkit.ChatColor;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import me.chiss.Core.Module.AModule;
import me.chiss.Core.Wiki.WikiArticle;
import me.chiss.Core.Wiki.WikiInput;
import me.chiss.Core.Wiki.WikiUtil;
import mineplex.core.server.IRepository;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
public class Wiki extends AModule
{
private WikiInput _wikiInput;
public Wiki(JavaPlugin plugin, IRepository repository)
{
super("Wiki", plugin, repository);
}
private HashMap<String, LinkedList<WikiArticle>> _articleMap;
private HashMap<String, String> _itemMap;
private LinkedList<WikiArticle> _pendingMap;
private LinkedList<WikiArticle> _deniedMap;
@Override
public void enable()
{
_wikiInput = new WikiInput(this);
_articleMap = new HashMap<String, LinkedList<WikiArticle>>();
_itemMap = new HashMap<String, String>();
_pendingMap = new LinkedList<WikiArticle>();
_deniedMap = new LinkedList<WikiArticle>();
_articleMap.clear();
/*
ServerWikiToken serverWikiToken = Repository.GetServerWikis();
for (ItemWikiToken item : serverWikiToken.ItemWikis)
{
for (WikiRevisionToken revision : item.Revisions)
{
AddItem(item.TypeId, item.Data, revision.Title, revision.Body, revision.Revision, revision.Author, revision.SystemTime);
if (revision.Revision > 0)
{
publishCount++;
}
else if (revision.Revision == 0)
{
pendingCount++;
}
else
{
deniedCount++;
}
}
}
for (GameClassWikiToken gameClass : serverWikiToken.GameClassWikis)
{
for (WikiRevisionToken revision : gameClass.Revisions)
{
AddArticle(new WikiArticle(revision.Title, revision.Body, revision.Revision, revision.Author, revision.SystemTime));
if (revision.Revision > 0)
{
publishCount++;
}
else if (revision.Revision == 0)
{
pendingCount++;
}
else
{
deniedCount++;
}
}
}
for (SkillWikiToken skillWiki : serverWikiToken.SkillWikis)
{
for (WikiRevisionToken revision : skillWiki.Revisions)
{
AddArticle(new WikiArticle(revision.Title, revision.Body, revision.Revision, revision.Author, revision.SystemTime));
if (revision.Revision > 0)
{
publishCount++;
}
else if (revision.Revision == 0)
{
pendingCount++;
}
else
{
deniedCount++;
}
}
}
Log("Loaded " + publishCount + " Published Wiki Articles");
Log("Loaded " + pendingCount + " Pending Wiki Articles.");
Log("Loaded " + deniedCount + " Denied Wiki Articles.");
Log("Loaded Wiki. " + UtilTime.since(epoch));
*/
}
@Override
public void disable()
{
_articleMap.clear();
}
@Override
public void config()
{
}
@Override
public void commands()
{
// AddCommand("w");
}
@Override
public void command(Player caller, String cmd, String[] args)
{
if (args.length == 0)
return;
// create commands
}
@EventHandler
public void handleInteract(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
_wikiInput.wikiBlock(event);
}
@EventHandler
public void handleInteractEntity(PlayerInteractEntityEvent event)
{
_wikiInput.wikiEntity(event);
}
public HashMap<String, LinkedList<WikiArticle>> GetArticles()
{
return _articleMap;
}
public HashMap<String, String> GetItems()
{
return _itemMap;
}
public LinkedList<WikiArticle> GetArticlesPending()
{
return _pendingMap;
}
public LinkedList<WikiArticle> GetArticlesDenied()
{
return _deniedMap;
}
public void Display(Player player, WikiArticle article)
{
if (article == null)
return;
//Display
UtilPlayer.message(player, article.Display(), true);
//Save
Clients().Get(player).Wiki().SetLastArticle(article);
Clients().Get(player).Wiki().SetLastTime(System.currentTimeMillis());
}
public String link(String message)
{
for (String cur : GetArticles().keySet())
{
String endColor = ChatColor.getLastColors(C.cWhite + message);
message = message.replaceAll("(?i)" + C.mChat + cur, C.mLink + cur + endColor);
message = message.replaceAll("(?i)" + " " + cur, C.mLink + " " + cur + endColor);
}
return message;
}
public WikiArticle searchArticle(String title, Player caller, boolean inform)
{
LinkedList<String> matchList = new LinkedList<String>();
for (String cur : GetArticles().keySet())
{
if (cur.equalsIgnoreCase(title))
return getActive(cur);
if (cur.toLowerCase().contains(title.toLowerCase()))
{
matchList.add(cur);
}
}
if (matchList.size() != 1)
{
if (!inform)
return null;
//Inform
UtilPlayer.message(caller, F.main("Wiki Search", "" +
C.mCount + matchList.size() +
C.mBody + " matches for [" +
C.mElem + title +
C.mBody + "]."));
if (matchList.size() > 0)
{
String matchString = "";
for (String cur : matchList)
matchString += C.mElem + cur + C.mBody + ", ";
matchString = matchString.substring(0, matchString.length()-2);
UtilPlayer.message(caller, F.main("Wiki Search", "" +
C.mBody + "Matches [" +
C.mElem + matchString +
C.mBody + "]."));
}
return null;
}
return getActive(matchList.getFirst());
}
public WikiArticle getActive(String title)
{
if (!GetArticles().containsKey(title))
return null;
return GetArticles().get(title).getFirst();
}
public WikiArticle getActive(ItemStack stack)
{
String title = GetItems().get(WikiUtil.getItem(stack, false));
if (title != null)
return getActive(title);
title = GetItems().get(WikiUtil.getItem(stack, true));
if (title != null)
return getActive(title);
return null;
}
public WikiArticle getActive(Block block)
{
String title = GetItems().get(WikiUtil.getBlock(block, false));
if (title != null)
return getActive(title);
title = GetItems().get(WikiUtil.getBlock(block, true));
if (title != null)
return getActive(title);
return null;
}
public WikiArticle getRevision(String title, int revision)
{
if (!GetArticles().containsKey(title))
return null;
if (revision < 0)
revision = 0;
if (revision >= GetArticles().get(title).size())
revision = GetArticles().get(title).size() - 1;
return GetArticles().get(title).get(revision);
}
}

View File

@ -1,8 +0,0 @@
package me.chiss.Core.Plugin;
import org.bukkit.event.player.AsyncPlayerChatEvent;
public interface IChat
{
public void HandleChat(AsyncPlayerChatEvent event, String filteredMessage);
}

View File

@ -1,6 +0,0 @@
package me.chiss.Core.Plugin;
public interface ILogger
{
public void Log(String moduleName, String data);
}

View File

@ -1,49 +0,0 @@
package me.chiss.Core.Plugin;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import me.chiss.Core.Config.Config;
import me.chiss.Core.Loot.LootFactory;
import me.chiss.Core.Module.ModuleManager;
import me.chiss.Core.Modules.*;
import me.chiss.Core.Server.Server;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.creature.Creature;
import mineplex.core.energy.Energy;
import mineplex.core.packethandler.INameColorer;
import mineplex.core.pet.PetManager;
import mineplex.core.projectile.ProjectileManager;
import mineplex.core.spawn.Spawn;
import mineplex.core.teleport.Teleport;
import mineplex.minecraft.game.core.fire.Fire;
public interface IPlugin
{
public void Log(String moduleName, String data);
public JavaPlugin GetPlugin();
public ModuleManager GetModules();
public Config GetConfig();
public Utility GetUtility();
public Blood GetBlood();
public BlockRegenerate GetBlockRegenerate();
public BlockRestore GetBlockRestore();
public Creature GetCreature();
public Energy GetEnergy();
public Fire GetFire();
public me.chiss.Core.Modules.Logger GetLogger();
public LootFactory GetLoot();
public Observer GetObserver();
public Server GetServer();
public Spawn GetSpawn();
public Teleport GetTeleport();
public ProjectileManager GetThrow();
public Location GetSpawnLocation();
public String GetWebServerAddress();
public PetManager GetPetManager();
}

View File

@ -1,77 +0,0 @@
package me.chiss.Core.Plugin;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import me.chiss.Core.Clans.Clans;
import me.chiss.Core.Class.ClassFactory;
import me.chiss.Core.Client.CoreClientManager;
import me.chiss.Core.Combat.CombatManager;
import me.chiss.Core.Condition.ConditionManager;
import me.chiss.Core.Config.Config;
import me.chiss.Core.Damage.DamageManager;
import me.chiss.Core.Loot.LootFactory;
import me.chiss.Core.Module.ModuleManager;
import me.chiss.Core.Modules.*;
import me.chiss.Core.NAC.NAC;
import me.chiss.Core.Pet.PetManager;
import me.chiss.Core.PlayerTagNamer.INameColorer;
import me.chiss.Core.Punish.Punish;
import me.chiss.Core.Skill.SkillFactory;
public interface IPlugin
{
public void Log(String moduleName, String data);
public JavaPlugin GetPlugin();
public IRelation GetRelation();
public ModuleManager GetModules();
public Config GetConfig();
public CoreClientManager GetClients();
public Utility GetUtility();
public Punish GetBan();
public Blood GetBlood();
public BlockRegenerate GetBlockRegenerate();
public BlockRestore GetBlockRestore();
public NAC GetNAC();
public Clans GetClans();
public ClassFactory GetClasses();
public Compass GetCompass();
public ConditionManager GetCondition();
public CombatManager GetCombat();
public Creature GetCreature();
public DamageManager GetDamage();
public Donation GetDonation();
public Energy GetEnergy();
public Explosion GetExplosion();
public Field GetField();
public Fire GetFire();
public Fix GetFix();
public Give GetGive();
public Ignore GetIgnore();
public ItemStackFactory GetItemStackFactory();
public me.chiss.Core.Modules.Logger GetLogger();
public LootFactory GetLoot();
public Message GetMessage();
public Observer GetObserver();
public Recharge GetRecharge();
public Server GetServer();
public SkillFactory GetSkills();
public Spawn GetSpawn();
public Teleport GetTeleport();
public Throw GetThrow();
public Weapon GetWeapon();
public Wiki GetWiki();
public Location GetSpawnLocation();
public String GetWebServerAddress();
public INameColorer GetNameColorer();
public PetManager GetPetManager();
}

View File

@ -1,10 +0,0 @@
package me.chiss.Core.Plugin;
import org.bukkit.entity.Player;
public interface IRelation
{
public boolean CanHurt(Player a, Player b);
public boolean CanHurt(String a, String b);
public boolean IsSafe(Player a);
}

View File

@ -1,9 +0,0 @@
package me.chiss.Core.Plugin;
public class Logger implements ILogger
{
public void Log(String source, String message)
{
System.out.println("[" + source + "]" + " " + message);
}
}

View File

@ -1,8 +0,0 @@
package me.chiss.Core.PvpShop;
import java.util.Collection;
public interface IPvpShopFactory
{
Collection<IShopItem> GetItems();
}

View File

@ -1,21 +0,0 @@
package me.chiss.Core.PvpShop;
import org.bukkit.Material;
public interface IShopItem
{
Material GetType();
byte GetData();
int GetAmount();
int GetTokenCost();
int GetPointCost();
int GetCreditCost();
int GetEconomyCost();
boolean IsFree();
int GetSalesPackageId();
String GetName();
String[] GetDesc();
int GetSlot();
String GetDeliveryName();
float GetReturnPercent();
}

View File

@ -1,248 +0,0 @@
package me.chiss.Core.PvpShop;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Collection;
import java.util.HashMap;
import mineplex.core.server.IRepository;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemStackFactory;
import me.chiss.Core.Module.AModule;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class PvpShopFactory extends AModule implements IPvpShopFactory
{
private String _loadFile;
private HashMap<String, IShopItem> _items;
public PvpShopFactory(JavaPlugin plugin, IRepository repository, String loadFile)
{
super("Shop Factory", plugin, repository);
_items = new HashMap<String, IShopItem>();
_loadFile = loadFile;
PopulateItems();
}
@Override
public void enable()
{
}
@Override
public void disable()
{
}
@Override
public void config()
{
}
@Override
public void commands()
{
AddCommand("pvpshop");
}
@Override
public void command(Player caller, String cmd, String[] args)
{
if (!Clients().Get(caller).Rank().Has(Rank.ADMIN, true))
return;
if (args.length == 0)
{
UtilPlayer.message(caller, F.main(GetName(), "Listing Items;"));
for (IShopItem cur : GetItems())
{
UtilPlayer.message(caller, cur.GetName());
}
UtilPlayer.message(caller, "Type " + F.elem("/pvpshop <Item>") + " to receive Item.");
return;
}
for (IShopItem cur : GetItems())
{
if (cur.GetName().toLowerCase().contains(args[0].toLowerCase()))
{
caller.getInventory().addItem(ItemStackFactory.Instance.CreateStack(cur.GetType(), cur.GetAmount()));
UtilPlayer.message(caller, F.main(GetName(), "You received " + F.elem(cur.GetName()) + "."));
}
}
}
private void PopulateItems()
{
_items.clear();
FileInputStream fstream = null;
DataInputStream in = null;
BufferedReader br = null;
try
{
fstream = new FileInputStream(_loadFile);
in = new DataInputStream(fstream);
br = new BufferedReader(new InputStreamReader(in));
String strLine;
int line = 1;
int col = 0;
while ((strLine = br.readLine()) != null)
{
String[] tokens = strLine.split(" ");
if (tokens.length == 1)
{
if (tokens[0].equals("-"))
{
col++;
continue;
}
try
{
line = Integer.parseInt(tokens[0]);
col = 0;
continue;
}
catch (Exception e)
{
System.out.println("Shop Load - Invalid Line: " + tokens[0]);
continue;
}
}
if (tokens.length != 8)
{
System.out.println("Shop Load - Invalid Token Count: (" + tokens.length + ") " + strLine);
continue;
}
try
{
//Name
String name = null;
if (!tokens[5].equals("null")) name = tokens[5].replaceAll("_", " ");
//Delivery Name
String deliveryName = null;
if (!tokens[6].equals("null")) deliveryName = tokens[6].replaceAll("_", " ");
//Desc
String[] desc = null;
if (!tokens[7].equals("null"))
{
desc = tokens[7].split(",");
for (int i=0 ; i<desc.length ; i++)
desc[i] = desc[i].replaceAll("_", " ");
}
//Material
Material mat = Material.getMaterial(tokens[0]);
if (mat == null)
{
System.out.println("Shop Load - Invalid Material: " + strLine);
continue;
}
//Data
byte data = Byte.parseByte(tokens[1]);
//Amount
int amount = Integer.parseInt(tokens[2]);
//Price
int price = Integer.parseInt(tokens[3]);
//Sale
float percent = Float.parseFloat(tokens[4]);
AddItem(new ShopItem(this, name, deliveryName, desc, mat, data, amount, price, percent, (line*9) + col));
col++;
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Shop Load - Invalid Line: " + strLine);
}
}
}
catch (Exception e)
{
System.out.println("Shop Load - File Missing: " + _loadFile);
}
finally
{
if (br != null)
{
try
{
br.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
if (in != null)
{
try
{
in.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
if (fstream != null)
{
try
{
fstream.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
}
public IShopItem GetItem(String ItemName)
{
return _items.get(ItemName);
}
@Override
public Collection<IShopItem> GetItems()
{
return _items.values();
}
public void AddItem(IShopItem newItem)
{
_items.put(newItem.GetName(), newItem);
}
}

View File

@ -1,163 +0,0 @@
package me.chiss.Core.PvpShop;
import mineplex.minecraft.game.core.classcombat.item.repository.ItemToken;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemStackFactory;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class ShopItem implements IShopItem, Listener
{
protected PvpShopFactory Factory;
private int _salesPackageId = 0;
private Material _type;
private byte _data;
private String _name;
private String _deliveryName;
private String[] _desc;
private int _amount;
private boolean _free;
private int _tokenCost;
private int _creditCost;
private int _pointCost;
private int _economyCost;
private int _slot;
private boolean _canDamage;
private float _returnPercent = 0.25f;
public ShopItem(PvpShopFactory factory, String name, String deliveryName, String[] desc,
Material type, byte data, int amount, int economyCost, float returnPercent, int slot)
{
Factory = factory;
if (name != null) _name = name;
else _name = ItemStackFactory.Instance.GetName(type, data, false);
if (deliveryName != null) _deliveryName = name;
else _deliveryName = ItemStackFactory.Instance.GetName(type, data, true);
_returnPercent = returnPercent;
if (desc != null) _desc = desc;
else _desc = new String[]{"Left-Click: " + C.cWhite + "Purchase", "Right-Click: " + C.cWhite + "Sell All at " + (int)(_returnPercent * 100) + "%"};
_type = type;
_data = data;
_amount = amount;
_slot = slot;
_economyCost = economyCost;
_free = true;
}
@Override
public Material GetType()
{
return _type;
}
@Override
public byte GetData()
{
return _data;
}
@Override
public int GetAmount()
{
return _amount;
}
@Override
public int GetTokenCost()
{
return _tokenCost;
}
@Override
public int GetCreditCost()
{
return _creditCost;
}
@Override
public int GetPointCost()
{
return _pointCost;
}
@Override
public int GetEconomyCost()
{
return _economyCost;
}
@Override
public int GetSalesPackageId()
{
return _salesPackageId;
}
@Override
public String GetName()
{
return _name;
}
@Override
public String GetDeliveryName()
{
return _deliveryName;
}
/*
@EventHandler
public void Damage(CustomDamageEvent event)
{
Player damager = event.GetDamagerPlayer(false);
if (damager == null) return;
if (!UtilGear.isMat(damager.getItemInHand(), GetType()))
return;
if (!_canDamage)
event.SetCancelled("Item Damage Cancel");
}
*/
@Override
public boolean IsFree()
{
return _free;
}
public void Update(ItemToken itemToken)
{
_salesPackageId = itemToken.SalesPackage.GameSalesPackageId;
_creditCost = itemToken.SalesPackage.BlueGems;
_pointCost = itemToken.SalesPackage.GreenGems;
_free = itemToken.SalesPackage.Free;
}
@Override
public String[] GetDesc()
{
return _desc;
}
@Override
public int GetSlot()
{
return _slot;
}
public float GetReturnPercent()
{
return _returnPercent;
}
}

View File

@ -1,22 +0,0 @@
package me.chiss.Core.Scheduler;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
public class ForceDailyCommand extends CommandBase<Scheduler>
{
public ForceDailyCommand(Scheduler plugin)
{
super(plugin, Rank.ADMIN, "forcedaily");
}
@Override
public void Execute(Player caller, String[] args)
{
Plugin.ResetStartOfDay();
}
}

View File

@ -1,6 +0,0 @@
package me.chiss.Core.Scheduler;
public interface IScheduleListener
{
public void AppointmentFire();
}

View File

@ -1,90 +0,0 @@
package me.chiss.Core.Scheduler;
import java.util.Calendar;
import java.util.HashMap;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.TimeSpan;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
public class Scheduler extends MiniPlugin
{
public static Scheduler Instance;
private HashMap<IScheduleListener, Long> _listenerMap;
private long _startOfDay = 0;
public static void Initialize(JavaPlugin plugin)
{
if (Instance == null)
Instance = new Scheduler(plugin);
}
private Scheduler(JavaPlugin plugin)
{
super("Scheduler", plugin);
_listenerMap = new HashMap<IScheduleListener, Long>();
Calendar calender = Calendar.getInstance();
_startOfDay = System.currentTimeMillis() - calender.get(Calendar.HOUR_OF_DAY) * TimeSpan.HOUR - calender.get(Calendar.MINUTE) * TimeSpan.MINUTE - calender.get(Calendar.SECOND) * TimeSpan.SECOND - calender.get(Calendar.MILLISECOND);
}
@Override
public void AddCommands()
{
addCommand(new ForceDailyCommand(this));
}
@EventHandler
public void UpdateDaily(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
for (IScheduleListener listener : _listenerMap.keySet())
{
if (_listenerMap.get(listener) < TimeSpan.DAY && _listenerMap.get(listener) + _startOfDay <= System.currentTimeMillis())
{
listener.AppointmentFire();
_listenerMap.put(listener, _listenerMap.get(listener) + TimeSpan.DAY);
}
}
if (System.currentTimeMillis() - _startOfDay >= TimeSpan.DAY)
ResetStartOfDay();
}
public void ScheduleDailyRecurring(IScheduleListener listener, long offsetFromDay)
{
long time = (TimeSpan.DAY + offsetFromDay) % TimeSpan.DAY;
_listenerMap.put(listener, time);
if (_listenerMap.get(listener) + _startOfDay <= System.currentTimeMillis())
_listenerMap.put(listener, _listenerMap.get(listener) + TimeSpan.DAY);
}
public void ResetStartOfDay()
{
for (IScheduleListener listener : _listenerMap.keySet())
{
if (_listenerMap.get(listener) >= TimeSpan.DAY)
{
_listenerMap.put(listener, _listenerMap.get(listener) - TimeSpan.DAY);
}
}
_startOfDay = System.currentTimeMillis();
}
public long GetTimeTilNextAppt(IScheduleListener listener)
{
return _listenerMap.get(listener) + _startOfDay - System.currentTimeMillis();
}
}

View File

@ -1,182 +0,0 @@
package me.chiss.Core.Server;
import me.chiss.Core.Events.ServerSaveEvent;
import me.chiss.Core.Server.command.ListCommand;
import me.chiss.Core.Server.command.SpawnSetCommand;
import me.chiss.Core.Server.command.WaterSpreadCommand;
import mineplex.core.MiniPlugin;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.chat.command.BroadcastCommand;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class Server extends MiniPlugin
{
private CoreClientManager _clientManager;
public boolean stopWeather = true;
public boolean liquidSpread = true;
public Server(JavaPlugin plugin, CoreClientManager clientManager)
{
super("Server", plugin);
_clientManager = clientManager;
}
@Override
public void AddCommands()
{
addCommand(new BroadcastCommand(this));
addCommand(new ListCommand(this));
addCommand(new SpawnSetCommand(this));
addCommand(new WaterSpreadCommand(this));
}
@EventHandler
public void WorldTimeWeather(UpdateEvent event)
{
if (event.getType() == UpdateType.TICK)
{
for (World cur : UtilServer.getServer().getWorlds())
{
if (cur.getTime() > 12000 && cur.getTime() < 24000)
cur.setTime(cur.getTime() + 5);
if (cur.getTime() > 14000 && cur.getTime() < 22000)
cur.setTime(22000);
if (stopWeather)
{
cur.setStorm(false);
cur.setThundering(false);
}
}
}
if (event.getType() == UpdateType.MIN_04)
{
ServerSaveEvent saveEvent = new ServerSaveEvent();
_plugin.getServer().getPluginManager().callEvent(saveEvent);
if (!saveEvent.isCancelled())
{
saveClients();
saveWorlds();
}
}
}
@EventHandler
public void WaterSpread(BlockFromToEvent event)
{
if (!liquidSpread)
event.setCancelled(true);
}
public void saveClients()
{
long epoch = System.currentTimeMillis();
//Save Clients
for (Player cur : UtilServer.getPlayers())
cur.saveData();
log("Saved Clients to Disk. Took " + (System.currentTimeMillis()-epoch) + " milliseconds.");
}
public void saveWorlds()
{
long epoch = System.currentTimeMillis();
//Save World
for (World cur : UtilServer.getServer().getWorlds())
cur.save();
UtilServer.broadcast(C.cGray + "Saved Worlds [" +
F.time(UtilTime.convertString((System.currentTimeMillis()-epoch), 1, TimeUnit.FIT)) +
"].");
log("Saved Worlds to Disk. Took " + (System.currentTimeMillis()-epoch) + " milliseconds.");
}
public void reload()
{
UtilServer.broadcast(F.main(_moduleName, "Reloading Plugins..."));
log("Reloading Plugins...");
UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "reload");
}
public void restart()
{
UtilServer.broadcast(F.main(_moduleName, "Restarting Server..."));
log("Restarting Server...");
for (Player cur : UtilServer.getPlayers())
UtilPlayer.kick(cur, _moduleName, "Server Restarting");
UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "stop");
}
@EventHandler
public void handleCommand(PlayerCommandPreprocessEvent event)
{
String cmdName = event.getMessage().split("\\s+")[0].substring(1);
if (cmdName.equalsIgnoreCase("reload") || cmdName.equalsIgnoreCase("rl"))
{
event.setCancelled(true);
if (_clientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.ADMIN, true))
reload();
}
else if (cmdName.equalsIgnoreCase("stop"))
{
event.setCancelled(true);
if (_clientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.ADMIN, true))
restart();
}
else if (cmdName.equalsIgnoreCase("reload"))
{
if (event.getPlayer().getName().equals("Chiss"))
return;
event.getPlayer().sendMessage("Plugins cannot be reloaded.");
event.setCancelled(true);
}
else if (cmdName.equalsIgnoreCase("me"))
{
event.setCancelled(true);
}
}
public CoreClientManager GetClientManager()
{
return _clientManager;
}
public void ToggleLiquidSpread()
{
liquidSpread = !liquidSpread;
}
public boolean GetLiquidSpread()
{
return liquidSpread;
}
}

View File

@ -1,52 +0,0 @@
package me.chiss.Core.Server.command;
import org.bukkit.entity.Player;
import me.chiss.Core.Server.Server;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
public class ListCommand extends CommandBase<Server>
{
public ListCommand(Server plugin)
{
super(plugin, Rank.ALL, "list", "playerlist", "who");
}
@Override
public void Execute(Player caller, String[] args)
{
UtilPlayer.message(caller, F.main(Plugin.getName(), "Listing Online Players:"));
String staff = "";
String other = "";
for (Player cur : UtilServer.getPlayers())
{
if (Plugin.GetClientManager().Get(cur).GetRank().Has(cur, Rank.MODERATOR, false))
{
staff += C.cWhite + cur.getName() + " ";
}
else
{
other += C.cWhite + cur.getName() + " ";
}
}
if (staff.length() == 0) staff = "None";
else staff = staff.substring(0, staff.length() - 1);
if (other.length() == 0) other = "None";
else other = other.substring(0, other.length() - 1);
UtilPlayer.message(caller, "§c§l" + "Staff");
UtilPlayer.message(caller, staff);
UtilPlayer.message(caller, "§a§l" + "Players");
UtilPlayer.message(caller, other);
}
}

View File

@ -1,21 +0,0 @@
package me.chiss.Core.Server.command;
import org.bukkit.entity.Player;
import me.chiss.Core.Server.Server;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
public class SpawnSetCommand extends CommandBase<Server>
{
public SpawnSetCommand(Server plugin)
{
super(plugin, Rank.ADMIN, "spawnset");
}
@Override
public void Execute(Player caller, String[] args)
{
caller.getWorld().setSpawnLocation(caller.getLocation().getBlockX(), caller.getLocation().getBlockY(), caller.getLocation().getBlockZ());
}
}

View File

@ -1,22 +0,0 @@
package me.chiss.Core.Server.command;
import org.bukkit.entity.Player;
import me.chiss.Core.Server.Server;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
public class WaterSpreadCommand extends CommandBase<Server>
{
public WaterSpreadCommand(Server plugin)
{
super(plugin, Rank.ADMIN, "waterspread");
}
@Override
public void Execute(Player caller, String[] args)
{
Plugin.ToggleLiquidSpread();
caller.sendMessage("Liquid Spread: " + Plugin.GetLiquidSpread());
}
}

View File

@ -1,17 +0,0 @@
package me.chiss.Core.Utility;
import me.chiss.Core.Modules.Utility;
public class AUtility
{
private Utility _util;
public AUtility(Utility util)
{
_util = util;
}
public Utility Util()
{
return _util;
}
}

View File

@ -1,125 +0,0 @@
package me.chiss.Core.Utility;
import java.util.HashMap;
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory;
import org.bukkit.inventory.ItemStack;
public class InventoryUtil
{
public static HashMap<Integer, ItemStack> removeItem(CraftInventory inventory, int endingSlot, ItemStack... items)
{
HashMap<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
if (endingSlot >= 54)
return leftover;
for (int i = 0; i < items.length; i++)
{
ItemStack item = items[i];
int toDelete = item.getAmount();
while (true)
{
int first = first(inventory, endingSlot, item, false);
if (first == -1)
{
item.setAmount(toDelete);
leftover.put(i, item);
break;
}
else
{
ItemStack itemStack = inventory.getItem(first);
int amount = itemStack.getAmount();
if (amount <= toDelete)
{
toDelete -= amount;
inventory.clear(first);
}
else
{
itemStack.setAmount(amount - toDelete);
inventory.setItem(first, itemStack);
toDelete = 0;
}
}
if (toDelete <= 0)
break;
}
}
return leftover;
}
public static int first(CraftInventory craftInventory, int endingSlot, ItemStack item, boolean withAmount)
{
if (endingSlot >= 54)
return -1;
ItemStack[] inventory = craftInventory.getContents();
for (int i = 0; i < endingSlot; i++)
{
if (inventory[i] == null)
{
if (item == null)
return i;
else
continue;
}
else if (item == null)
continue;
boolean equals = false;
if (withAmount)
{
equals = item.equals(inventory[i]);
}
else
{
equals = item.getTypeId() == inventory[i].getTypeId() && item.getDurability() == inventory[i].getDurability() && item.getEnchantments().equals(inventory[i].getEnchantments());
}
if (equals)
{
return i;
}
}
return -1;
}
public static int GetCountOfObjectsRemoved(CraftInventory getInventory, int i, ItemStack itemStack)
{
int count = 0;
while(getInventory.contains(itemStack.getType(), itemStack.getAmount()) && InventoryUtil.removeItem(getInventory, i, itemStack).size() == 0)
{
count++;
}
return count;
}
public static int GetCountOfObjectsRemovedInSlot(CraftInventory getInventory, int slot, ItemStack itemStack)
{
int count = 0;
ItemStack slotStack = getInventory.getItem(slot);
while(slotStack.getType() == itemStack.getType() && slotStack.getAmount() >= itemStack.getAmount())
{
slotStack.setAmount(slotStack.getAmount() - itemStack.getAmount());
count++;
}
if (slotStack.getAmount() == 0)
getInventory.setItem(slot, null);
return count;
}
}

View File

@ -1,37 +0,0 @@
package me.chiss.Core.Utility;
import me.chiss.Core.Modules.Utility;
import org.bukkit.entity.Player;
public class UtilAccount extends AUtility
{
public UtilAccount(Utility util)
{
super(util);
}
//Return Clean IP
public String IPtoStr(Player player)
{
if (player == null)
return "Unknown";
if (player.getAddress() == null)
return "Unknown";
String IP = player.getAddress().toString();
String trimIP = "";
for (int i = 0 ; i < IP.length() ; i++)
{
if (IP.charAt(i) == ':')
{
trimIP = IP.substring(1, i);
break;
}
}
return trimIP;
}
}

View File

@ -1,128 +0,0 @@
package me.chiss.Core.Utility;
import java.util.HashSet;
import me.chiss.Core.Modules.Utility;
public class UtilInput extends AUtility
{
public UtilInput(Utility util)
{
super(util);
}
//Valid Chars
protected HashSet<Character> validSet = new HashSet<Character>();
protected HashSet<String> filterSet = new HashSet<String>();
public boolean valid(String input)
{
if (validSet.isEmpty())
addChars();
for (char cur : input.toCharArray())
if (!validSet.contains(cur))
return false;
return true;
}
public String filter(String input)
{
if (filterSet.isEmpty())
addDictionary();
for (String cur : filterSet)
{
if (input.equalsIgnoreCase(cur))
{
String out = "" + input.charAt(0);
while (out.length() < input.length())
out += '*';
return out;
}
}
return input;
}
public void addDictionary()
{
filterSet.add("fuck");
filterSet.add("shit");
filterSet.add("cunt");
filterSet.add("ass");
filterSet.add("asshole");
filterSet.add("faggot");
filterSet.add("fag");
filterSet.add("gay");
}
public void addChars()
{
validSet.add('1');
validSet.add('2');
validSet.add('3');
validSet.add('4');
validSet.add('5');
validSet.add('6');
validSet.add('7');
validSet.add('8');
validSet.add('9');
validSet.add('0');
validSet.add('a');
validSet.add('b');
validSet.add('c');
validSet.add('d');
validSet.add('e');
validSet.add('f');
validSet.add('g');
validSet.add('h');
validSet.add('i');
validSet.add('j');
validSet.add('k');
validSet.add('l');
validSet.add('m');
validSet.add('n');
validSet.add('o');
validSet.add('p');
validSet.add('q');
validSet.add('r');
validSet.add('s');
validSet.add('t');
validSet.add('u');
validSet.add('v');
validSet.add('w');
validSet.add('x');
validSet.add('y');
validSet.add('z');
validSet.add('A');
validSet.add('B');
validSet.add('C');
validSet.add('D');
validSet.add('E');
validSet.add('F');
validSet.add('G');
validSet.add('H');
validSet.add('I');
validSet.add('J');
validSet.add('K');
validSet.add('L');
validSet.add('M');
validSet.add('N');
validSet.add('O');
validSet.add('P');
validSet.add('Q');
validSet.add('R');
validSet.add('S');
validSet.add('T');
validSet.add('U');
validSet.add('V');
validSet.add('W');
validSet.add('X');
validSet.add('Y');
validSet.add('Z');
}
}

View File

@ -1,123 +0,0 @@
package me.chiss.Core.Utility;
import java.util.LinkedList;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import me.chiss.Core.Modules.Utility;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
public class UtilItem extends AUtility
{
public UtilItem(Utility util)
{
super(util);
}
public LinkedList<Material> matchItem(Player caller, String items, boolean inform)
{
LinkedList<Material> matchList = new LinkedList<Material>();
String failList = "";
//Mass Search
for (String cur : items.split(","))
{
Material match = searchItem(caller, cur, inform);
if (match != null)
matchList.add(match);
else
failList += cur + " " ;
}
if (inform && failList.length() > 0)
{
failList = failList.substring(0, failList.length() - 1);
UtilPlayer.message(caller, F.main("Item(s) Search", "" +
C.mBody + " Invalid [" +
C.mElem + failList +
C.mBody + "]."));
}
return matchList;
}
public Material searchItem(Player caller, String args, boolean inform)
{
LinkedList<Material> matchList = new LinkedList<Material>();
for (Material cur : Material.values())
{
//By Name
if (cur.toString().equalsIgnoreCase(args))
return cur;
if (cur.toString().toLowerCase().contains(args.toLowerCase()))
matchList.add(cur);
//By ID:Data
String[] arg = args.split(":");
int id = 0;
try
{
if (arg.length > 0) id = Integer.parseInt(arg[0]);
}
catch (Exception e)
{
continue;
}
if (id == cur.getId())
return cur;
}
//No / Non-Unique
if (matchList.size() != 1)
{
if (!inform)
return null;
//Inform
UtilPlayer.message(caller, F.main("Item Search", "" +
C.mCount + matchList.size() +
C.mBody + " matches for [" +
C.mElem + args +
C.mBody + "]."));
if (matchList.size() > 0)
{
String matchString = "";
for (Material cur : matchList)
matchString += F.elem(cur.toString()) + ", ";
if (matchString.length() > 1)
matchString = matchString.substring(0 , matchString.length() - 2);
UtilPlayer.message(caller, F.main("Item Search", "" +
C.mBody + "Matches [" +
C.mElem + matchString +
C.mBody + "]."));
}
return null;
}
return matchList.get(0);
}
public String itemToStr(ItemStack item)
{
String data = "0";
if (item.getData() != null)
data = item.getData().getData() + "";
return item.getType() + ":" + item.getAmount() + ":" + item.getDurability() + ":" + data;
}
}

View File

@ -1,55 +0,0 @@
package me.chiss.Core.Vote;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClient;
import mineplex.core.account.event.GetClientEvent;
import mineplex.core.server.event.PlayerVoteEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
public class VoteManager extends MiniPlugin
{
public VoteManager(JavaPlugin plugin)
{
super("Vote", plugin);
}
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerVote(PlayerVoteEvent event)
{
GetClientEvent clientEvent = new GetClientEvent(event.GetPlayerName());
GetPluginManager().callEvent(clientEvent);
CoreClient client = clientEvent.GetClient();
if (client != null)
{
client.Donor().AddPoints(event.GetPointsReceived());
client.GetPlayer().sendMessage(ChatColor.AQUA + "*************************************");
client.GetPlayer().sendMessage(C.cDGreen + " Thanks for voting!");
client.GetPlayer().sendMessage(C.cDGreen + " You received " + ChatColor.YELLOW + event.GetPointsReceived() + C.cDGreen + " points! ");
client.GetPlayer().sendMessage(ChatColor.AQUA + "*************************************");
client.GetPlayer().playSound(client.GetPlayer().getLocation(), Sound.LEVEL_UP, .3f, 1f);
for (Player player : GetPlugin().getServer().getOnlinePlayers())
{
if (player == client.GetPlayer())
continue;
player.sendMessage(F.main(getName(), ChatColor.YELLOW + event.GetPlayerName() + ChatColor.GRAY + " voted at bettermc.com/Vote for " + ChatColor.YELLOW + event.GetPointsReceived() + C.cGray + " points! "));
}
client.GetPlayer().updateInventory();
}
}
}

View File

@ -1,46 +0,0 @@
package me.chiss.Core.Weapon.Commands;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemStackFactory;
import me.chiss.Core.Weapon.IWeapon;
import me.chiss.Core.Weapon.WeaponFactory;
public class WeaponCommand extends CommandBase<WeaponFactory>
{
public WeaponCommand(WeaponFactory plugin)
{
super(plugin, Rank.ADMIN, "wep", "weapon");
}
@Override
public void Execute(Player caller, String[] args)
{
if (args == null || args.length == 0)
{
UtilPlayer.message(caller, F.main(Plugin.getName(), "Listing Weapons:"));
for (IWeapon cur : Plugin.GetWeapons())
{
UtilPlayer.message(caller, cur.GetName());
}
UtilPlayer.message(caller, "Type " + F.elem("/weapon <Weapon>") + " to receive Weapon.");
return;
}
for (IWeapon cur : Plugin.GetWeapons())
{
if (cur.GetName().toLowerCase().contains(args[0].toLowerCase()))
{
caller.getInventory().addItem(ItemStackFactory.Instance.CreateStack(cur.GetType(), cur.GetAmount()));
UtilPlayer.message(caller, F.main("WeaponFactory", "You received " + F.elem(cur.GetName()) + "."));
}
}
}
}

View File

@ -1,18 +0,0 @@
package me.chiss.Core.Weapon;
import nautilus.minecraft.core.webserver.token.Server.WeaponToken;
import org.bukkit.Material;
public interface IWeapon
{
Material GetType();
int GetAmount();
int GetGemCost();
int GetEconomyCost();
boolean IsFree();
int GetSalesPackageId();
String GetName();
void Update(WeaponToken weaponToken);
String[] GetDesc();
}

View File

@ -1,8 +0,0 @@
package me.chiss.Core.Weapon;
import java.util.Collection;
public interface IWeaponFactory
{
Collection<IWeapon> GetWeapons();
}

View File

@ -1,83 +0,0 @@
package me.chiss.Core.Weapon;
import nautilus.minecraft.core.webserver.token.Server.WeaponToken;
import org.bukkit.Material;
public class Weapon implements IWeapon
{
private int _salesPackageId;
private String _customName;
private Material _type;
private int _amount;
private int _gemCost;
private int _economyCost;
private boolean _free;
private String[] _desc;
public Weapon(String customName, String[] desc, Material type, int amount, int gemCost)
{
_customName = customName;
_desc = desc;
_type = type;
_amount = amount;
_gemCost = gemCost;
_economyCost = 0;
}
@Override
public Material GetType()
{
return _type;
}
@Override
public int GetAmount()
{
return _amount;
}
@Override
public int GetGemCost()
{
return _gemCost;
}
@Override
public int GetEconomyCost()
{
return _economyCost;
}
@Override
public int GetSalesPackageId()
{
return _salesPackageId;
}
@Override
public String GetName()
{
return (_customName != null ? _customName :_type.name());
}
@Override
public boolean IsFree()
{
return _free;
}
@Override
public void Update(WeaponToken weaponToken)
{
_salesPackageId = weaponToken.SalesPackage.GameSalesPackageId;
_gemCost = weaponToken.SalesPackage.Gems;
_free = weaponToken.SalesPackage.Free;
}
@Override
public String[] GetDesc()
{
return _desc;
}
}

View File

@ -1,100 +0,0 @@
package me.chiss.Core.Weapon;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import me.chiss.Core.Weapon.Commands.WeaponCommand;
import mineplex.core.MiniPlugin;
import mineplex.core.donation.repository.GameSalesPackageToken;
import mineplex.core.server.remotecall.JsonWebCall;
import nautilus.minecraft.core.webserver.token.Server.WeaponToken;
import org.bukkit.Material;
import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken;
import org.bukkit.plugin.java.JavaPlugin;
public class WeaponFactory extends MiniPlugin implements IWeaponFactory
{
public static WeaponFactory Instance;
private HashMap<String, IWeapon> _weapons;
private String _webServerAddress;
protected WeaponFactory(JavaPlugin plugin, String webServerAddress)
{
super("Weapon Factory", plugin);
_weapons = new HashMap<String, IWeapon>();
_webServerAddress = webServerAddress;
PopulateWeapons();
}
public static void Initialize(JavaPlugin plugin, String webServerAddress)
{
Instance = new WeaponFactory(plugin, webServerAddress);
}
@Override
public void AddCommands()
{
addCommand(new WeaponCommand(this));
}
private void PopulateWeapons()
{
_weapons.clear();
AddWeapon(new Weapon("Standard Bow", new String[] { }, Material.BOW, 1, 800));
AddWeapon(new Weapon("Power Bow", new String[] { "+1 Damage" }, Material.BOW, 1, 800));
AddWeapon(new Weapon("Booster Bow", new String[] { "+1 Skill Level", "-1 Damage" }, Material.BOW, 1, 800));
AddWeapon(new Weapon("Standard Axe", new String[] { }, Material.IRON_AXE, 1, 600));
AddWeapon(new Weapon("Power Axe", new String[] { "+1 Damage", "Low Durability" }, Material.GOLD_AXE, 1, 600));
AddWeapon(new Weapon("Booster Axe", new String[] { "+1 Skill Level", "-1 Damage" }, Material.DIAMOND_AXE, 1, 600));
AddWeapon(new Weapon("Standard Sword", new String[] { }, Material.IRON_SWORD, 1, 600));
AddWeapon(new Weapon("Power Sword", new String[] { "+1 Damage", "Low Durability" }, Material.GOLD_SWORD, 1, 600));
AddWeapon(new Weapon("Booster Sword", new String[] { "+1 Skill Level", "-1 Damage" }, Material.DIAMOND_SWORD, 1, 600));
List<WeaponToken> weaponTokens = new ArrayList<WeaponToken>();
for (IWeapon weapon : _weapons.values())
{
WeaponToken weaponToken = new WeaponToken();
weaponToken.Name = weapon.GetName();
weaponToken.SalesPackage = new GameSalesPackageToken();
weaponToken.SalesPackage.Gems = weapon.GetGemCost();
weaponTokens.add(weaponToken);
}
List<WeaponToken> weapons = new JsonWebCall(_webServerAddress + "Dominate/GetWeapons").Execute(new TypeToken<List<WeaponToken>>(){}.getType(), weaponTokens);
for (WeaponToken weaponToken : weapons)
{
if (_weapons.containsKey(weaponToken.Name))
{
_weapons.get(weaponToken.Name).Update(weaponToken);
}
}
}
public IWeapon GetWeapon(String weaponName)
{
return _weapons.get(weaponName);
}
@Override
public Collection<IWeapon> GetWeapons()
{
return _weapons.values();
}
public void AddWeapon(IWeapon newWeapon)
{
_weapons.put(newWeapon.GetName(), newWeapon);
}
}

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/bukkit.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Mineplex.Minecraft.BungeeSigns</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -1,11 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="bukkit" level="project" />
</component>
</module>

View File

@ -1,4 +0,0 @@
name: BungeeSigns
main: mineplex.minecraft.BungeeSigns.BungeeSigns
version: 1
author: defek7

View File

@ -1,378 +0,0 @@
package mineplex.minecraft.BungeeSigns;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.messaging.PluginMessageListener;
public class BungeeSigns extends JavaPlugin implements Listener, PluginMessageListener, Runnable
{
private HashMap<String, Location> _signs = new HashMap<String, Location>();
private HashMap<String, Long> _signUpdate = new HashMap<String, Long>();
@Override
public void onEnable()
{
LoadSigns();
getServer().getPluginManager().registerEvents(this, this);
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeSigns");
getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeSigns", this);
getServer().getScheduler().scheduleSyncRepeatingTask(this, this, 0L, 40L);
}
public void onDisable()
{
_signs.clear();
}
@EventHandler
public void PlayerBreakSign(BlockBreakEvent event)
{
if (event.isCancelled())
return;
if ((event.getBlock().getType() == Material.WALL_SIGN || event.getBlock().getType() == Material.SIGN_POST))
{
String serverName = ChatColor.stripColor(((Sign)event.getBlock().getState()).getLine(1));
if (_signs.containsKey(serverName))
{
_signs.remove(serverName);
SaveSigns();
}
}
}
@EventHandler
public void PlayerClickSign(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getClickedBlock() != null && (event.getClickedBlock().getType() == Material.WALL_SIGN || event.getClickedBlock().getType() == Material.SIGN_POST) && _signs.containsKey(ChatColor.stripColor(((Sign)event.getClickedBlock().getState()).getLine(1))))
{
String serverName = ChatColor.stripColor(((Sign)event.getClickedBlock().getState()).getLine(1));
if (_signUpdate.containsKey(serverName) && _signUpdate.get(serverName) == -1L)
{
event.getPlayer().sendMessage(ChatColor.BLUE + "BungeeSigns" + ChatColor.GRAY + "> " + ChatColor.RED + "That server is offline.");
return;
}
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try
{
out.writeUTF("Connect");
out.writeUTF(serverName);
}
catch (IOException e)
{
// Can never happen
}
finally
{
try
{
out.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
event.getPlayer().sendPluginMessage(this, "BungeeCord", b.toByteArray());
}
}
@EventHandler
public void PlayerPlaceSign(SignChangeEvent event)
{
if (event.isCancelled() || !event.getPlayer().isOp())
return;
if (event.getBlock().getType() == Material.WALL_SIGN || event.getBlock().getType() == Material.SIGN_POST)
{
if (event.getLine(0).equalsIgnoreCase("[BungeeSigns]"))
{
if (_signs.containsKey(event.getLine(1)) && _signs.get(event.getLine(1)) != event.getBlock().getLocation())
{
_signs.get(event.getLine(1)).getBlock().setType(Material.AIR);
}
_signs.put(event.getLine(1), event.getBlock().getLocation());
SaveSigns();
}
}
}
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message)
{
if (!channel.equalsIgnoreCase("BungeeSigns"))
return;
DataInputStream in = null;
String serverName = null;
String motd = null;
int players = 0;
int maxPlayers = 0;
try
{
in = new DataInputStream(new ByteArrayInputStream(message));
serverName = in.readUTF();
motd = in.readUTF();
players = in.readInt();
maxPlayers = in.readInt();
if (_signs.containsKey(serverName))
{
Block block = _signs.get(serverName).getBlock();
if (block != null && block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN_POST)
{
Sign sign = (Sign)block.getState();
sign.setLine(0, ChatColor.UNDERLINE + "Click to Join!");
sign.setLine(1, ChatColor.BOLD + serverName);
sign.setLine(2, motd);
sign.setLine(3, players + "/" + maxPlayers);
sign.update(true);
}
_signUpdate.put(serverName, System.currentTimeMillis());
}
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
try
{
in.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
public void run()
{
if (getServer().getOnlinePlayers().size() > 0)
{
for (String serverName : _signs.keySet())
{
if (!_signUpdate.containsKey(serverName))
{
_signUpdate.put(serverName, System.currentTimeMillis());
}
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try
{
out.writeUTF(serverName);
}
catch (IOException e)
{
e.printStackTrace();
}
getServer().getOnlinePlayers().iterator().next().sendPluginMessage(this, "BungeeSigns", b.toByteArray());
if (_signUpdate.get(serverName) != -1L && System.currentTimeMillis() - _signUpdate.get(serverName) > 5000)
{
Block block = _signs.get(serverName).getBlock();
if (block != null && block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN_POST)
{
Sign sign = (Sign)block.getState();
sign.setLine(0, ChatColor.UNDERLINE + "" + ChatColor.DARK_RED + "Don't touch me!");
sign.setLine(1, ChatColor.BOLD + serverName);
sign.setLine(2, ChatColor.DARK_RED + "OFFLINE");
sign.setLine(3, "?/?");
sign.update(true);
}
_signUpdate.put(serverName, -1L);
}
}
}
}
public void SaveSigns()
{
FileWriter fstream = null;
BufferedWriter out = null;
try
{
fstream = new FileWriter("BungeeSigns.dat");
out = new BufferedWriter(fstream);
for (String key : _signs.keySet())
{
out.write(key + " " + locToStr(_signs.get(key)));
out.newLine();
}
out.close();
}
catch (Exception e)
{
System.err.println("BungeeSigns Save Error: " + e.getMessage());
}
finally
{
if (out != null)
{
try
{
out.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
if (fstream != null)
{
try
{
fstream.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
}
public void LoadSigns()
{
FileInputStream fstream = null;
BufferedReader br = null;
try
{
File npcFile = new File("BungeeSigns.dat");
if (npcFile.exists())
{
fstream = new FileInputStream(npcFile);
br = new BufferedReader(new InputStreamReader(fstream));
String line = br.readLine();
while (line != null)
{
String name = line.split(" ")[0];
String location = line.split(" ")[1];
_signs.put(name, strToLoc(location));
line = br.readLine();
}
}
}
catch (Exception e)
{
System.out.println("BungeeSigns Error parsing npc file : " + e.getMessage());
}
finally
{
if (br != null)
{
try
{
br.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
if (fstream != null)
{
try
{
fstream.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
}
public String locToStr(Location loc)
{
if (loc == null)
return "";
return loc.getWorld().getName() + "," + loc.getX() + "," + loc.getY() + "," + loc.getZ();
}
public Location strToLoc(String string)
{
if (string.length() == 0)
return null;
String[] tokens = string.split(",");
try
{
for (World world : getServer().getWorlds())
{
if (world.getName().equalsIgnoreCase(tokens[0]))
{
return new Location(world, Double.parseDouble(tokens[1]), Double.parseDouble(tokens[2]), Double.parseDouble(tokens[3]));
}
}
}
catch (Exception e)
{
return null;
}
return null;
}
}

View File

@ -1,17 +0,0 @@
package mineplex.minecraft.BungeeSigns;
import org.bukkit.Location;
public class ServerInfo
{
public String BungeeName;
public String DisplayName;
public Location Location;
public ServerInfo(String bungeeName, String displayName, Location location)
{
BungeeName = bungeeName;
DisplayName = displayName;
Location = location;
}
}

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Nautilus.Game.CaptureThePig</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -1,11 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -1,11 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -1,8 +0,0 @@
package nautilus.game.core.scoreboard;
import nautilus.game.core.player.IGamePlayer;
public interface IScoreHandler<PlayerType extends IGamePlayer>
{
void RewardForDeath(PlayerType player);
}

View File

@ -1,13 +0,0 @@
package nautilus.game.core.scoreboard;
import nautilus.game.core.engine.ITeam;
import nautilus.game.core.player.ITeamGamePlayer;
public interface ITeamScoreHandler<PlayerType extends ITeamGamePlayer<PlayerTeamType>, PlayerTeamType extends ITeam<PlayerType>> extends IScoreHandler<PlayerType>
{
void RewardForTeamKill(PlayerType killer, PlayerType victim);
void RewardForKill(PlayerType killer, PlayerType victim, int assists);
void RewardForAssist(PlayerType assistant, PlayerType victim);
}

View File

@ -1,64 +0,0 @@
package nautilus.game.core.scoreboard;
import net.minecraft.server.v1_7_R1.EntityPlayer;
import net.minecraft.server.v1_7_R1.Packet201PlayerInfo;
public class LineTracker
{
private String _line = null;
private String _oldLine = null;
private Packet201PlayerInfo _clearOldPacket;
private Packet201PlayerInfo _addNewPacket;
private Packet201PlayerInfo _clearNewPacket;
public LineTracker()
{
_line = null;
}
public void SetLine(String s)
{
if (s != null && s.length() > 16)
s = s.substring(0, 16);
_oldLine = _line;
_line = s;
if (_oldLine != null)
{
_clearOldPacket = new Packet201PlayerInfo(_oldLine, false, 0);
}
if (_line != null)
{
_addNewPacket = new Packet201PlayerInfo(_line, true, 0);
_clearNewPacket = new Packet201PlayerInfo(_line, false, 0);
}
}
public void DisplayLineToPlayer(EntityPlayer entityPlayer)
{
if (_oldLine != null)
{
entityPlayer.playerConnection.sendPacket(_clearOldPacket);
}
if (_line != null)
{
entityPlayer.playerConnection.sendPacket(_addNewPacket);
}
}
public void RemoveLineForPlayer(EntityPlayer entityPlayer)
{
if (_line != null)
{
entityPlayer.playerConnection.sendPacket(_clearNewPacket);
}
}
public void ClearOldLine()
{
_oldLine = null;
}
}

View File

@ -1,16 +0,0 @@
package nautilus.game.core.scoreboard;
import java.util.Comparator;
import nautilus.game.core.player.IGamePlayer;
public class PlayerPointSorter<PlayerType extends IGamePlayer> implements Comparator<PlayerType>
{
public int compare(PlayerType a, PlayerType b)
{
if (a.GetPoints() != b.GetPoints())
return b.GetPoints() - a.GetPoints();
return a.getName().toLowerCase().compareTo(b.getName().toLowerCase());
}
}

View File

@ -1,304 +0,0 @@
package nautilus.game.core.scoreboard;
import org.bukkit.ChatColor;
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.packethandler.IPacketRunnable;
import mineplex.core.packethandler.PacketArrayList;
import mineplex.core.packethandler.PacketHandler;
import mineplex.minecraft.game.classcombat.Class.ClassManager;
import mineplex.minecraft.game.classcombat.Class.ClientClass;
import nautilus.game.core.engine.ITeam;
import nautilus.game.core.game.ITeamGame;
import nautilus.game.core.player.ITeamGamePlayer;
import nautilus.minecraft.core.utils.TimeStuff;
import net.minecraft.server.v1_7_R1.EntityPlayer;
import net.minecraft.server.v1_7_R1.Packet;
import net.minecraft.server.v1_7_R1.Packet201PlayerInfo;
public class TabScoreboard<GameType extends ITeamGame<?, PlayerType, TeamType>, PlayerType extends ITeamGamePlayer<TeamType>, TeamType extends ITeam<PlayerType>> implements IPacketRunnable
{
protected CoreClientManager ClientManager;
protected ClassManager ClassManager;
protected PacketHandler PacketHandler;
protected NautHashMap<String, NautHashMap<Integer, LineTracker>> MainColumn;
protected GameType Game;
protected NautHashMap<Integer, LineTracker> RedColumn;
protected NautHashMap<Integer, LineTracker> BlueColumn;
private boolean _updating = false;
public TabScoreboard(JavaPlugin plugin, CoreClientManager clientManager, ClassManager classManager, PacketHandler packetHandler, GameType game)
{
ClientManager = clientManager;
ClassManager = classManager;
PacketHandler = packetHandler;
Game = game;
RedColumn = new NautHashMap<Integer, LineTracker>();
BlueColumn = new NautHashMap<Integer, LineTracker>();
MainColumn = new NautHashMap<String, NautHashMap<Integer, LineTracker>>();
for (Integer i=0; i < 20; i++)
{
RedColumn.put(i, new LineTracker());
}
for (Integer i=0; i < 20; i++)
{
BlueColumn.put(i, new LineTracker());
}
PacketHandler.AddPacketRunnable(this);
}
public void Update()
{
SetRedTeamInfo();
SetBlueTeamInfo();
for (PlayerType player : Game.GetPlayers())
{
UpdateForPlayer(player);
if (player.isOnline())
SendPlayerScoreboard(player);
}
for (PlayerType player : Game.GetSpectators())
{
UpdateForPlayer(player);
SendPlayerScoreboard(player);
}
for (Integer i=0; i < 20; i++)
{
RedColumn.get(i).ClearOldLine();
}
for (Integer i=0; i < 20; i++)
{
BlueColumn.get(i).ClearOldLine();
}
}
public void AddSpectator(PlayerType spectator)
{
UpdateForPlayer(spectator);
SendPlayerScoreboard(spectator);
}
public void Stop()
{
for (Integer i=0; i < 20; i++)
{
RedColumn.get(i).SetLine("");
}
for (Integer i=0; i < 20; i++)
{
BlueColumn.get(i).SetLine("");
}
Packet201PlayerInfo clearPacket = new Packet201PlayerInfo("", false, 0);
_updating = true;
for (PlayerType player : Game.GetPlayers())
{
NautHashMap<Integer, LineTracker> playerLines = MainColumn.get(player.getName());
// If player quit as game was preparing and never reconnected...
if (playerLines != null)
{
for (Integer i=0; i < 20; i++)
{
playerLines.get(i).SetLine("");
}
SendPlayerScoreboard(player);
EntityPlayer entityPlayer = ((CraftPlayer)player.GetPlayer()).getHandle();
entityPlayer.playerConnection.sendPacket(clearPacket);
}
}
for (PlayerType player : Game.GetSpectators())
{
NautHashMap<Integer, LineTracker> playerLines = MainColumn.get(player.getName());
for (Integer i=0; i < 20; i++)
{
playerLines.get(i).SetLine("");
}
SendPlayerScoreboard(player);
EntityPlayer entityPlayer = ((CraftPlayer)player.GetPlayer()).getHandle();
entityPlayer.playerConnection.sendPacket(clearPacket);
}
_updating = false;
PacketHandler.RemovePacketRunnable(this);
}
public void UpdateForPlayer(PlayerType player)
{
SetMainInfo(player);
}
protected void SetRedTeamInfo()
{
RedColumn.get(0).SetLine(ChatColor.RED + " [RED]");
RedColumn.get(1).SetLine(ChatColor.RED + "Score: " + ChatColor.WHITE + Game.GetRedTeam().GetScore());
RedColumn.get(8).SetLine(ChatColor.RED + " [Players]");
RedColumn.get(9).SetLine(ChatColor.RED + " [K/D/A S]");
String spacer = "";
for (int i=0; i < 5; i++)
{
int lineIndex = 10 + i * 2;
spacer += " ";
if (i < Game.GetRedTeam().GetPlayers().size())
{
PlayerType player = Game.GetRedTeam().GetPlayers().get(i);
ChatColor playerColor = !player.isOnline() ? ChatColor.DARK_GRAY : ChatColor.WHITE;
RedColumn.get(lineIndex).SetLine(playerColor + player.getName());
RedColumn.get(lineIndex+1).SetLine(ChatColor.RED + "" + player.GetKills() + "/" + player.GetDeaths() + "/" + player.GetAssists() + " " + player.GetPoints() + spacer);
}
else
{
RedColumn.get(lineIndex).SetLine(ChatColor.RED + "" + ChatColor.GREEN + spacer);
RedColumn.get(lineIndex+1).SetLine(ChatColor.RED + "" + ChatColor.BLUE + spacer);
}
}
}
protected void SetMainInfo(PlayerType player)
{
if (!player.isOnline())
return;
ClientClass clientPlayer = ClassManager.Get(player.GetPlayer());
if (!MainColumn.containsKey(player.getName()))
{
NautHashMap<Integer, LineTracker> playerLines = new NautHashMap<Integer, LineTracker>();
for (Integer i=0; i < 20; i++)
{
playerLines.put(i, new LineTracker());
}
MainColumn.put(player.getName(), playerLines);
}
NautHashMap<Integer, LineTracker> playerLines = MainColumn.get(player.getName());
playerLines.get(0).SetLine(ChatColor.GREEN + " [Dominate]");
playerLines.get(1).SetLine(ChatColor.GREEN + "Map:");
playerLines.get(2).SetLine(Game.GetArena().GetName());
playerLines.get(3).SetLine(ChatColor.GREEN + "Win Limit:");
playerLines.get(4).SetLine(Game.GetWinLimit() + "");
playerLines.get(5).SetLine(ChatColor.GREEN + "Duration:");
playerLines.get(6).SetLine((Game.GetStartTime() == 0 ? "0" : TimeStuff.GetTimespanString(System.currentTimeMillis() - Game.GetStartTime())));
playerLines.get(7).SetLine(ChatColor.GREEN + "");
playerLines.get(8).SetLine(ChatColor.GREEN + " [Stats]");
playerLines.get(9).SetLine(ChatColor.GREEN + "Class:" );
playerLines.get(10).SetLine((clientPlayer.GetGameClass() == null ? "None" : clientPlayer.GetGameClass().GetName()));
playerLines.get(11).SetLine(ChatColor.GREEN + "Kills:");
playerLines.get(12).SetLine(player.GetKills() + " ");
playerLines.get(13).SetLine(ChatColor.GREEN + "Deaths:");
playerLines.get(14).SetLine(player.GetDeaths() + " ");
playerLines.get(15).SetLine(ChatColor.GREEN + "Assists:");
playerLines.get(16).SetLine(player.GetAssists() + " ");
playerLines.get(17).SetLine(ChatColor.GREEN + "Score:");
playerLines.get(18).SetLine(player.GetPoints() + " ");
playerLines.get(19).SetLine(ChatColor.GREEN + " ");
}
protected void SetBlueTeamInfo()
{
BlueColumn.get(0).SetLine(ChatColor.BLUE + " [BLUE]");
BlueColumn.get(1).SetLine(ChatColor.BLUE + "Score: " + ChatColor.WHITE + Game.GetBlueTeam().GetScore());
BlueColumn.get(8).SetLine(ChatColor.BLUE + " [Players]");
BlueColumn.get(9).SetLine(ChatColor.BLUE + " [K/D/A S]");
String spacer = "";
for (int i=0; i < 5; i++)
{
int lineIndex = 10 + i * 2;
spacer += " ";
if (i < Game.GetBlueTeam().GetPlayers().size())
{
PlayerType player = Game.GetBlueTeam().GetPlayers().get(i);
ChatColor playerColor = !player.isOnline() ? ChatColor.DARK_GRAY : ChatColor.WHITE;
BlueColumn.get(lineIndex).SetLine(playerColor + player.getName());
BlueColumn.get(lineIndex+1).SetLine(ChatColor.BLUE + "" + player.GetKills() + "/" + player.GetDeaths() + "/" + player.GetAssists() + " " + player.GetPoints() + spacer);
}
else
{
BlueColumn.get(lineIndex).SetLine(ChatColor.BLUE + " " + ChatColor.GREEN + spacer);
BlueColumn.get(lineIndex+1).SetLine(ChatColor.BLUE + " " + ChatColor.RED + spacer);
}
}
}
public void ClearScoreboardForSpectator(PlayerType player)
{
EntityPlayer entityPlayer = ((CraftPlayer)player.GetPlayer()).getHandle();
NautHashMap<Integer, LineTracker> playersLines = MainColumn.get(player.getName());
if (playersLines == null)
return;
_updating = true;
for (Integer i=0; i < 20; i++)
{
RedColumn.get(i).RemoveLineForPlayer(entityPlayer);
playersLines.get(i).RemoveLineForPlayer(entityPlayer);
BlueColumn.get(i).RemoveLineForPlayer(entityPlayer);
}
_updating = false;
MainColumn.remove(player.getName());
}
public void SendPlayerScoreboard(PlayerType player)
{
EntityPlayer entityPlayer = ((CraftPlayer)player.GetPlayer()).getHandle();
NautHashMap<Integer, LineTracker> playersLines = MainColumn.get(player.getName());
_updating = true;
for (int i=0; i < 20; i++)
{
RedColumn.get(i).DisplayLineToPlayer(entityPlayer);
playersLines.get(i).DisplayLineToPlayer(entityPlayer);
BlueColumn.get(i).DisplayLineToPlayer(entityPlayer);
playersLines.get(i).ClearOldLine();
}
_updating = false;
}
@Override
public boolean run(Packet packet, Player owner, PacketArrayList packetList)
{
if (packet instanceof Packet201PlayerInfo)
{
if (Game.IsPlayerInGame(owner) && Game.IsActive())
return _updating;
}
return true;
}
}

View File

@ -1,60 +0,0 @@
package nautilus.game.core.scoreboard;
import nautilus.game.core.arena.ITeamArena;
import nautilus.game.core.engine.ITeam;
import nautilus.game.core.game.ITeamGame;
import nautilus.game.core.notifier.TeamPlayerNotifier;
import nautilus.game.core.player.ITeamGamePlayer;
import org.bukkit.ChatColor;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
public abstract class TeamGameScoreHandler<NotifierType extends TeamPlayerNotifier<GameType, ArenaType, PlayerTeamType, PlayerType>, GameType extends ITeamGame<ArenaType, PlayerType, PlayerTeamType>, ArenaType extends ITeamArena, PlayerTeamType extends ITeam<PlayerType>, PlayerType extends ITeamGamePlayer<PlayerTeamType>> implements ITeamScoreHandler<PlayerType, PlayerTeamType>, Listener
{
protected NotifierType Notifier;
public TeamGameScoreHandler(JavaPlugin plugin, NotifierType notifier)
{
Notifier = notifier;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
public void Stop()
{
HandlerList.unregisterAll(this);
}
public void RewardForDeath(PlayerType player)
{
player.AddPoints(-5);
Notifier.BroadcastMessageToPlayer("Your score was reduced by " + ChatColor.YELLOW + 5 + ChatColor.GRAY + " for dying!", player.GetPlayer());
}
public void RewardForTeamKill(PlayerType killer, PlayerType victim)
{
killer.AddPoints(-25);
Notifier.BroadcastMessageToPlayer("You team killed " + victim.getName() + " and reduced your score by " + ChatColor.YELLOW + -25 + ChatColor.GRAY + "!", killer.GetPlayer());
}
public void RewardForKill(PlayerType killer, PlayerType victim, int assists)
{
int deathValue = 15;
int deathPoints = deathValue + GetKillModifierValue(killer, victim, assists);
killer.AddPoints(deathPoints - (assists * 2));
Notifier.BroadcastMessageToPlayer("You killed " + victim.getName() + " for an additional +" + ChatColor.YELLOW + (deathPoints - (assists * 2)) + ChatColor.GRAY + " to your score!", killer.GetPlayer());
}
public void RewardForAssist(PlayerType assistant, PlayerType victim)
{
assistant.AddPoints(2);
Notifier.BroadcastMessageToPlayer("You helped kill " + victim.getName() + " for an additional +" + ChatColor.YELLOW + 2 + ChatColor.GRAY + " to your score!", assistant.GetPlayer());
}
protected abstract int GetKillModifierValue(PlayerType killer, PlayerType victim, int assists);
}

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Nautilus.Game.Deathmatch</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -1,11 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/bukkit.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Core"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.ClassCombat"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
<classpathentry kind="output" path="bin"/>
</classpath>

Some files were not shown because too many files have changed in this diff Show More