mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-04 14:31:26 +01:00
Merge remote branch 'remotes/origin/master' into release
This commit is contained in:
commit
16a0f44b4d
@ -17,6 +17,8 @@ import org.bukkit.permissions.Permission;
|
|||||||
import org.bukkit.permissions.PermissionAttachment;
|
import org.bukkit.permissions.PermissionAttachment;
|
||||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
|
||||||
@ -857,4 +859,58 @@ public class OfflinePlayer implements Player
|
|||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hidePlayer(Player player)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showPlayer(Player player)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canSee(Player player)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean addPotionEffect(PotionEffect pe)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean addPotionEffect(PotionEffect pe, boolean bln)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean addPotionEffects(Collection<PotionEffect> clctn)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPotionEffect(PotionEffectType pet)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removePotionEffect(PotionEffectType pet)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<PotionEffect> getActivePotionEffects()
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import java.util.Map;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ public class Trade
|
|||||||
{
|
{
|
||||||
this(null, null, items, null, ess);
|
this(null, null, items, null, ess);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Trade(final int exp, final IEssentials ess)
|
public Trade(final int exp, final IEssentials ess)
|
||||||
{
|
{
|
||||||
this(null, null, null, exp, ess);
|
this(null, null, null, exp, ess);
|
||||||
@ -79,9 +80,10 @@ public class Trade
|
|||||||
{
|
{
|
||||||
throw new ChargeException(_("notEnoughMoney"));
|
throw new ChargeException(_("notEnoughMoney"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exp != null && exp > 0
|
if (exp != null && exp > 0
|
||||||
&& SetExpFix.getTotalExperience(user) < exp) {
|
&& SetExpFix.getTotalExperience(user) < exp)
|
||||||
|
{
|
||||||
throw new ChargeException(_("notEnoughExperience"));
|
throw new ChargeException(_("notEnoughExperience"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,9 +105,25 @@ public class Trade
|
|||||||
if (dropItems)
|
if (dropItems)
|
||||||
{
|
{
|
||||||
final Map<Integer, ItemStack> leftOver = InventoryWorkaround.addItem(user.getInventory(), true, getItemStack());
|
final Map<Integer, ItemStack> leftOver = InventoryWorkaround.addItem(user.getInventory(), true, getItemStack());
|
||||||
|
final Location loc = user.getLocation();
|
||||||
for (ItemStack itemStack : leftOver.values())
|
for (ItemStack itemStack : leftOver.values())
|
||||||
{
|
{
|
||||||
InventoryWorkaround.dropItem(user.getLocation(), itemStack);
|
final int maxStackSize = itemStack.getType().getMaxStackSize();
|
||||||
|
final int stacks = itemStack.getAmount() / maxStackSize;
|
||||||
|
final int leftover = itemStack.getAmount() % maxStackSize;
|
||||||
|
final Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)];
|
||||||
|
for (int i = 0; i < stacks; i++)
|
||||||
|
{
|
||||||
|
final ItemStack stack = itemStack.clone();
|
||||||
|
stack.setAmount(maxStackSize);
|
||||||
|
itemStacks[i] = loc.getWorld().dropItem(loc, stack);
|
||||||
|
}
|
||||||
|
if (leftover > 0)
|
||||||
|
{
|
||||||
|
final ItemStack stack = itemStack.clone();
|
||||||
|
stack.setAmount(leftover);
|
||||||
|
itemStacks[stacks] = loc.getWorld().dropItem(loc, stack);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -173,7 +191,7 @@ public class Trade
|
|||||||
{
|
{
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getExperience()
|
public Integer getExperience()
|
||||||
{
|
{
|
||||||
return exp;
|
return exp;
|
||||||
|
@ -554,4 +554,28 @@ public class FakeWorld implements World
|
|||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getTicksPerAnimalSpawns()
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTicksPerAnimalSpawns(int i)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getTicksPerMonsterSpawns()
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTicksPerMonsterSpawns(int i)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,12 @@
|
|||||||
package com.earth2me.essentials.craftbukkit;
|
package com.earth2me.essentials.craftbukkit;
|
||||||
|
|
||||||
import com.earth2me.essentials.craftbukkit.FakeInventory;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Item;
|
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This class can be removed when
|
* This class can be removed when https://github.com/Bukkit/CraftBukkit/pull/193 is accepted to CraftBukkit
|
||||||
* https://github.com/Bukkit/CraftBukkit/pull/193
|
|
||||||
* is accepted to CraftBukkit
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class InventoryWorkaround
|
public final class InventoryWorkaround
|
||||||
@ -47,7 +42,7 @@ public final class InventoryWorkaround
|
|||||||
{
|
{
|
||||||
return firstPartial(cinventory, item, forceDurability, item.getType().getMaxStackSize());
|
return firstPartial(cinventory, item, forceDurability, item.getType().getMaxStackSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int firstPartial(final Inventory cinventory, final ItemStack item, final boolean forceDurability, final int maxAmount)
|
public static int firstPartial(final Inventory cinventory, final ItemStack item, final boolean forceDurability, final int maxAmount)
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null)
|
||||||
@ -93,10 +88,9 @@ public final class InventoryWorkaround
|
|||||||
{
|
{
|
||||||
final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
|
final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
|
||||||
|
|
||||||
/* TODO: some optimization
|
/*
|
||||||
* - Create a 'firstPartial' with a 'fromIndex'
|
* TODO: some optimization - Create a 'firstPartial' with a 'fromIndex' - Record the lastPartial per Material -
|
||||||
* - Record the lastPartial per Material
|
* Cache firstEmpty result
|
||||||
* - Cache firstEmpty result
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// combine items
|
// combine items
|
||||||
@ -175,7 +169,7 @@ public final class InventoryWorkaround
|
|||||||
|
|
||||||
final int amount = item.getAmount();
|
final int amount = item.getAmount();
|
||||||
final int partialAmount = partialItem.getAmount();
|
final int partialAmount = partialItem.getAmount();
|
||||||
|
|
||||||
// Check if it fully fits
|
// Check if it fully fits
|
||||||
if (amount + partialAmount <= maxAmount)
|
if (amount + partialAmount <= maxAmount)
|
||||||
{
|
{
|
||||||
@ -325,25 +319,4 @@ public final class InventoryWorkaround
|
|||||||
}
|
}
|
||||||
return leftover.isEmpty();
|
return leftover.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Item[] dropItem(final Location loc, final ItemStack itm)
|
|
||||||
{
|
|
||||||
final int maxStackSize = itm.getType().getMaxStackSize();
|
|
||||||
final int stacks = itm.getAmount() / maxStackSize;
|
|
||||||
final int leftover = itm.getAmount() % maxStackSize;
|
|
||||||
final Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)];
|
|
||||||
for (int i = 0; i < stacks; i++)
|
|
||||||
{
|
|
||||||
final ItemStack stack = itm.clone();
|
|
||||||
stack.setAmount(maxStackSize);
|
|
||||||
itemStacks[i] = loc.getWorld().dropItem(loc, stack);
|
|
||||||
}
|
|
||||||
if (leftover > 0)
|
|
||||||
{
|
|
||||||
final ItemStack stack = itm.clone();
|
|
||||||
stack.setAmount(leftover);
|
|
||||||
itemStacks[stacks] = loc.getWorld().dropItem(loc, stack);
|
|
||||||
}
|
|
||||||
return itemStacks;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -291,8 +291,8 @@ sethome-multiple:
|
|||||||
# essentials.sethome.multiple.staff
|
# essentials.sethome.multiple.staff
|
||||||
staff: 10
|
staff: 10
|
||||||
|
|
||||||
#Set timeout in seconds for players to accept tpa before request is cancelled.
|
# Set timeout in seconds for players to accept tpa before request is cancelled.
|
||||||
#Set to 0 for no timeout
|
# Set to 0 for no timeout
|
||||||
tpa-accept-cancellation: 0
|
tpa-accept-cancellation: 0
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
@ -313,7 +313,7 @@ command-costs:
|
|||||||
#example: 1000
|
#example: 1000
|
||||||
# /kit tools costs $1500 PER USE
|
# /kit tools costs $1500 PER USE
|
||||||
#kit-tools: 1500
|
#kit-tools: 1500
|
||||||
|
|
||||||
# Set this to a currency symbol you want to use.
|
# Set this to a currency symbol you want to use.
|
||||||
currency-symbol: '$'
|
currency-symbol: '$'
|
||||||
|
|
||||||
@ -346,22 +346,22 @@ hide-permissionless-help: true
|
|||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
chat:
|
chat:
|
||||||
|
|
||||||
# If EssentialsChat is installed, this will define how far a player's voice travels, in blocks. Set to 0 to make all chat global.
|
# If EssentialsChat is installed, this will define how far a player's voice travels, in blocks. Set to 0 to make all chat global.
|
||||||
# Note that users with the "essentials.chat.spy" permission will hear everything, regardless of this setting.
|
# Note that users with the "essentials.chat.spy" permission will hear everything, regardless of this setting.
|
||||||
# Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!)
|
# Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!)
|
||||||
# Or with essentials.chat.question can override this by prefixing text with a question mark (?)
|
# Or with essentials.chat.question can override this by prefixing text with a question mark (?)
|
||||||
# You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section."
|
# You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section."
|
||||||
radius: 0
|
radius: 0
|
||||||
|
|
||||||
# Chat formatting can be done in two ways, you can either define a standard format for all chat
|
# Chat formatting can be done in two ways, you can either define a standard format for all chat
|
||||||
# Or you can give a group specific chat format, to give some extra variation.
|
# Or you can give a group specific chat format, to give some extra variation.
|
||||||
# If set to the default chat format which "should" be compatible with ichat.
|
# If set to the default chat format which "should" be compatible with ichat.
|
||||||
# For more information of chat formatting, check out the wiki: http://ess.khhq.net/wiki/Chat_Formatting
|
# For more information of chat formatting, check out the wiki: http://ess.khhq.net/wiki/Chat_Formatting
|
||||||
|
|
||||||
format: '<{DISPLAYNAME}> {MESSAGE}'
|
format: '<{DISPLAYNAME}> {MESSAGE}'
|
||||||
#format: '&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}'
|
#format: '&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}'
|
||||||
|
|
||||||
group-formats:
|
group-formats:
|
||||||
# Default: '{WORLDNAME} {DISPLAYNAME}&7:&f {MESSAGE}'
|
# Default: '{WORLDNAME} {DISPLAYNAME}&7:&f {MESSAGE}'
|
||||||
# Admins: '{WORLDNAME} &c[{GROUP}]&f {DISPLAYNAME}&7:&c {MESSAGE}'
|
# Admins: '{WORLDNAME} &c[{GROUP}]&f {DISPLAYNAME}&7:&c {MESSAGE}'
|
||||||
@ -400,13 +400,13 @@ protect:
|
|||||||
|
|
||||||
# Which blocks should people be prevented from placing
|
# Which blocks should people be prevented from placing
|
||||||
placement: 10,11,46,327
|
placement: 10,11,46,327
|
||||||
|
|
||||||
# Which items should people be prevented from using
|
# Which items should people be prevented from using
|
||||||
usage: 327
|
usage: 327
|
||||||
|
|
||||||
# Which blocks should people be prevented from breaking
|
# Which blocks should people be prevented from breaking
|
||||||
break:
|
break:
|
||||||
|
|
||||||
# Which blocks should not be pushed by pistons
|
# Which blocks should not be pushed by pistons
|
||||||
piston:
|
piston:
|
||||||
|
|
||||||
@ -460,12 +460,12 @@ protect:
|
|||||||
mushroom_cow: false
|
mushroom_cow: false
|
||||||
magma_cube: false
|
magma_cube: false
|
||||||
snowman: false
|
snowman: false
|
||||||
|
|
||||||
# Maximum height the creeper should explode. -1 allows them to explode everywhere.
|
# Maximum height the creeper should explode. -1 allows them to explode everywhere.
|
||||||
# Set prevent.creeper-explosion to true, if you want to disable creeper explosions.
|
# Set prevent.creeper-explosion to true, if you want to disable creeper explosions.
|
||||||
creeper:
|
creeper:
|
||||||
max-height: -1
|
max-height: -1
|
||||||
|
|
||||||
# Protect various blocks.
|
# Protect various blocks.
|
||||||
protect:
|
protect:
|
||||||
# Protect all signs
|
# Protect all signs
|
||||||
@ -481,7 +481,7 @@ protect:
|
|||||||
|
|
||||||
# Prevent placing blocks above protected rails, this is to stop a potential griefing
|
# Prevent placing blocks above protected rails, this is to stop a potential griefing
|
||||||
prevent-block-on-rails: false
|
prevent-block-on-rails: false
|
||||||
|
|
||||||
# Store blocks / signs in memory before writing
|
# Store blocks / signs in memory before writing
|
||||||
memstore: false
|
memstore: false
|
||||||
|
|
||||||
@ -510,14 +510,14 @@ protect:
|
|||||||
|
|
||||||
# Burn, baby, burn! Should fire damage be disabled?
|
# Burn, baby, burn! Should fire damage be disabled?
|
||||||
firedmg: false
|
firedmg: false
|
||||||
|
|
||||||
# Should the damage after hit by a lightning be disabled?
|
# Should the damage after hit by a lightning be disabled?
|
||||||
lightning: false
|
lightning: false
|
||||||
|
|
||||||
# Should people with build: false in permissions be allowed to build
|
# Should people with build: false in permissions be allowed to build
|
||||||
# Set true to disable building for those people
|
# Set true to disable building for those people
|
||||||
build: true
|
build: true
|
||||||
|
|
||||||
# Should people with build: false in permissions be allowed to use items
|
# Should people with build: false in permissions be allowed to use items
|
||||||
# Set true to disable using for those people
|
# Set true to disable using for those people
|
||||||
use: true
|
use: true
|
||||||
@ -544,7 +544,7 @@ newbies:
|
|||||||
# If not, set to ''
|
# If not, set to ''
|
||||||
#announce-format: ''
|
#announce-format: ''
|
||||||
announce-format: '&dWelcome {DISPLAYNAME}&d to the server!'
|
announce-format: '&dWelcome {DISPLAYNAME}&d to the server!'
|
||||||
|
|
||||||
# When we spawn for the first time, which spawnpoint do we use?
|
# When we spawn for the first time, which spawnpoint do we use?
|
||||||
# Set to "none" if you want to use the spawn point of the world.
|
# Set to "none" if you want to use the spawn point of the world.
|
||||||
spawnpoint: newbies
|
spawnpoint: newbies
|
||||||
|
@ -5,7 +5,7 @@ main: com.earth2me.essentials.Essentials
|
|||||||
version: TeamCity
|
version: TeamCity
|
||||||
website: http://tiny.cc/EssentialsCommands
|
website: http://tiny.cc/EssentialsCommands
|
||||||
description: Provides an essential, core set of commands for Bukkit.
|
description: Provides an essential, core set of commands for Bukkit.
|
||||||
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits]
|
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5]
|
||||||
commands:
|
commands:
|
||||||
afk:
|
afk:
|
||||||
description: Marks you as away-from-keyboard.
|
description: Marks you as away-from-keyboard.
|
||||||
@ -120,7 +120,7 @@ commands:
|
|||||||
aliases: [mem,memory,egc,emem,ememory]
|
aliases: [mem,memory,egc,emem,ememory]
|
||||||
give:
|
give:
|
||||||
description: Give a player an item.
|
description: Give a player an item.
|
||||||
usage: /<command> <player> <item|numeric> [amount <enchantmentname[:level]> ...]
|
usage: /<command> <player> <item|numeric> [amount <enchantmentname[:level]> ...]
|
||||||
aliases: [egive]
|
aliases: [egive]
|
||||||
god:
|
god:
|
||||||
description: Enables your godly powers.
|
description: Enables your godly powers.
|
||||||
@ -220,7 +220,7 @@ commands:
|
|||||||
aliases: [emute]
|
aliases: [emute]
|
||||||
near:
|
near:
|
||||||
description: Lists the players near by or around a player
|
description: Lists the players near by or around a player
|
||||||
usage: /<command> [playername] [radius]
|
usage: /<command> [playername] [radius]
|
||||||
aliases: [nearby,enear,enearby]
|
aliases: [nearby,enear,enearby]
|
||||||
nick:
|
nick:
|
||||||
description: Change your nickname or that of another player.
|
description: Change your nickname or that of another player.
|
||||||
|
@ -654,4 +654,16 @@ public class FakeServer implements Server
|
|||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTicksPerAnimalSpawns()
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTicksPerMonsterSpawns()
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,6 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.ConcurrentSkipListMap;
|
import java.util.concurrent.ConcurrentSkipListMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.event.Event.Priority;
|
|
||||||
import org.bukkit.event.Event.Type;
|
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
@ -5,6 +5,6 @@ main: com.earth2me.essentials.chat.EssentialsChat
|
|||||||
version: TeamCity
|
version: TeamCity
|
||||||
website: http://tiny.cc/EssentialsCommands
|
website: http://tiny.cc/EssentialsCommands
|
||||||
description: Provides chat control features for Essentials. Requires Permissions.
|
description: Provides chat control features for Essentials. Requires Permissions.
|
||||||
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, Okamosy]
|
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5, Okamosy]
|
||||||
depend: [Essentials]
|
depend: [Essentials]
|
||||||
#softdepend: [Factions]
|
#softdepend: [Factions]
|
@ -7,16 +7,15 @@ import java.util.Map;
|
|||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event.Priority;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Event.Type;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsHelp extends PlayerListener
|
public class EssentialsHelp implements Listener
|
||||||
{
|
{
|
||||||
private transient Player chatUser;
|
private transient Player chatUser;
|
||||||
private final transient Server server;
|
private final transient Server server;
|
||||||
@ -39,8 +38,7 @@ public class EssentialsHelp extends PlayerListener
|
|||||||
public void registerEvents()
|
public void registerEvents()
|
||||||
{
|
{
|
||||||
final PluginManager pluginManager = server.getPluginManager();
|
final PluginManager pluginManager = server.getPluginManager();
|
||||||
pluginManager.registerEvent(Type.PLAYER_QUIT, this, Priority.Low, plugin);
|
pluginManager.registerEvents(this, plugin);
|
||||||
pluginManager.registerEvent(Type.PLAYER_CHAT, this, Priority.Low, plugin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCommand(final CommandSender sender)
|
public void onCommand(final CommandSender sender)
|
||||||
@ -155,18 +153,17 @@ public class EssentialsHelp extends PlayerListener
|
|||||||
ircBot = new IrcBot(player, "Ess_" + player.getName(), UsernameUtil.createUsername(player));
|
ircBot = new IrcBot(player, "Ess_" + player.getName(), UsernameUtil.createUsername(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler
|
||||||
public void onPlayerChat(final PlayerChatEvent event)
|
public void onPlayerChat(final PlayerChatEvent event)
|
||||||
{
|
{
|
||||||
if (event.getPlayer() == chatUser)
|
if (event.getPlayer() == chatUser)
|
||||||
{
|
{
|
||||||
final boolean success = sendChatMessage(event.getPlayer(), event.getMessage());
|
final boolean success = sendChatMessage(event.getPlayer(), event.getMessage());
|
||||||
event.setCancelled(success);
|
event.setCancelled(success);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler
|
||||||
public void onPlayerQuit(final PlayerQuitEvent event)
|
public void onPlayerQuit(final PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
closeConnection();
|
closeConnection();
|
||||||
|
@ -7,18 +7,15 @@ import java.util.logging.Level;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.CustomEventListener;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Event.Priority;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.Event.Type;
|
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
|
||||||
|
|
||||||
|
|
||||||
public class UpdateProcess extends PlayerListener
|
public class UpdateProcess implements Listener
|
||||||
{
|
{
|
||||||
private transient Player currentPlayer;
|
private transient Player currentPlayer;
|
||||||
private final transient Plugin plugin;
|
private final transient Plugin plugin;
|
||||||
@ -34,21 +31,7 @@ public class UpdateProcess extends PlayerListener
|
|||||||
|
|
||||||
public void registerEvents()
|
public void registerEvents()
|
||||||
{
|
{
|
||||||
final PluginManager pluginManager = plugin.getServer().getPluginManager();
|
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||||
pluginManager.registerEvent(Type.PLAYER_QUIT, this, Priority.Low, plugin);
|
|
||||||
pluginManager.registerEvent(Type.PLAYER_CHAT, this, Priority.Lowest, plugin);
|
|
||||||
pluginManager.registerEvent(Type.PLAYER_JOIN, this, Priority.Normal, plugin);
|
|
||||||
pluginManager.registerEvent(Type.CUSTOM_EVENT, new CustomEventListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void onCustomEvent(final Event event)
|
|
||||||
{
|
|
||||||
if (event instanceof InstallationFinishedEvent)
|
|
||||||
{
|
|
||||||
UpdateProcess.this.currentPlayer = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, Priority.Normal, plugin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean selfUpdate()
|
public boolean selfUpdate()
|
||||||
@ -110,7 +93,13 @@ public class UpdateProcess extends PlayerListener
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler
|
||||||
|
public void onInstallationFinished(final InstallationFinishedEvent event)
|
||||||
|
{
|
||||||
|
UpdateProcess.this.currentPlayer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerChat(final PlayerChatEvent event)
|
public void onPlayerChat(final PlayerChatEvent event)
|
||||||
{
|
{
|
||||||
if (event.getPlayer() == currentPlayer)
|
if (event.getPlayer() == currentPlayer)
|
||||||
@ -130,7 +119,7 @@ public class UpdateProcess extends PlayerListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@EventHandler
|
||||||
public void onPlayerJoin(final PlayerJoinEvent event)
|
public void onPlayerJoin(final PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
|
BIN
lib/bukkit.jar
BIN
lib/bukkit.jar
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user