mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-26 11:07:55 +01:00
Merge branch '2.x' of github.com:drtshock/Essentials into 2.x
This commit is contained in:
commit
e5ebeaf724
@ -58,6 +58,8 @@ public interface ISettings extends IConf {
|
||||
|
||||
void addKit(String name, List<String> lines, long delay);
|
||||
|
||||
boolean isSkippingUsedOneTimeKitsFromKitList();
|
||||
|
||||
String getLocale();
|
||||
|
||||
String getNewbieSpawn();
|
||||
|
@ -56,7 +56,10 @@ public class Kit {
|
||||
}
|
||||
|
||||
Kit kit = new Kit(kitItem, ess);
|
||||
if (kit.getNextUse(user) != 0) {
|
||||
double nextUse = kit.getNextUse(user);
|
||||
if (nextUse == -1 && ess.getSettings().isSkippingUsedOneTimeKitsFromKitList()) {
|
||||
continue;
|
||||
} else if (nextUse != 0) {
|
||||
name = tl("kitDelay", name);
|
||||
}
|
||||
|
||||
|
@ -351,6 +351,11 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
config.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSkippingUsedOneTimeKitsFromKitList() {
|
||||
return config.getBoolean("skip-used-one-time-kits-from-kit-list", false);
|
||||
}
|
||||
|
||||
private ChatColor operatorColor = null;
|
||||
|
||||
@Override
|
||||
|
@ -11,6 +11,7 @@ import com.earth2me.essentials.utils.NumberUtil;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.MaxMoneyException;
|
||||
import net.ess3.api.events.AfkStatusChangeEvent;
|
||||
import net.ess3.api.events.JailStatusChangeEvent;
|
||||
import net.ess3.api.events.UserBalanceUpdateEvent;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -445,19 +446,24 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||
//Returns true if status expired during this check
|
||||
public boolean checkJailTimeout(final long currentTime) {
|
||||
if (getJailTimeout() > 0 && getJailTimeout() < currentTime && isJailed()) {
|
||||
setJailTimeout(0);
|
||||
setJailed(false);
|
||||
sendMessage(tl("haveBeenReleased"));
|
||||
setJail(null);
|
||||
try {
|
||||
getTeleport().back();
|
||||
} catch (Exception ex) {
|
||||
final JailStatusChangeEvent event = new JailStatusChangeEvent(this, null, false);
|
||||
ess.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
setJailTimeout(0);
|
||||
setJailed(false);
|
||||
sendMessage(tl("haveBeenReleased"));
|
||||
setJail(null);
|
||||
try {
|
||||
getTeleport().respawn(null, TeleportCause.PLUGIN);
|
||||
} catch (Exception ex1) {
|
||||
getTeleport().back();
|
||||
} catch (Exception ex) {
|
||||
try {
|
||||
getTeleport().respawn(null, TeleportCause.PLUGIN);
|
||||
} catch (Exception ex1) {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.DateUtil;
|
||||
import net.ess3.api.events.JailStatusChangeEvent;
|
||||
import org.bukkit.Server;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
@ -33,23 +34,29 @@ public class Commandtogglejail extends EssentialsCommand {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (player.getBase().isOnline()) {
|
||||
ess.getJails().sendToJail(player, args[1]);
|
||||
} else {
|
||||
// Check if jail exists
|
||||
ess.getJails().getJail(args[1]);
|
||||
final User controller = sender.isPlayer() ? ess.getUser(sender.getPlayer()) : null;
|
||||
final JailStatusChangeEvent event = new JailStatusChangeEvent(player, controller, true);
|
||||
ess.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (player.getBase().isOnline()) {
|
||||
ess.getJails().sendToJail(player, args[1]);
|
||||
} else {
|
||||
// Check if jail exists
|
||||
ess.getJails().getJail(args[1]);
|
||||
}
|
||||
player.setJailed(true);
|
||||
player.sendMessage(tl("userJailed"));
|
||||
player.setJail(null);
|
||||
player.setJail(args[1]);
|
||||
long timeDiff = 0;
|
||||
if (args.length > 2) {
|
||||
final String time = getFinalArg(args, 2);
|
||||
timeDiff = DateUtil.parseDateDiff(time, true);
|
||||
player.setJailTimeout(timeDiff);
|
||||
}
|
||||
sender.sendMessage((timeDiff > 0 ? tl("playerJailedFor", player.getName(), DateUtil.formatDateDiff(timeDiff)) : tl("playerJailed", player.getName())));
|
||||
}
|
||||
player.setJailed(true);
|
||||
player.sendMessage(tl("userJailed"));
|
||||
player.setJail(null);
|
||||
player.setJail(args[1]);
|
||||
long timeDiff = 0;
|
||||
if (args.length > 2) {
|
||||
final String time = getFinalArg(args, 2);
|
||||
timeDiff = DateUtil.parseDateDiff(time, true);
|
||||
player.setJailTimeout(timeDiff);
|
||||
}
|
||||
sender.sendMessage((timeDiff > 0 ? tl("playerJailedFor", player.getName(), DateUtil.formatDateDiff(timeDiff)) : tl("playerJailed", player.getName())));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -70,14 +77,20 @@ public class Commandtogglejail extends EssentialsCommand {
|
||||
if (!player.isJailed()) {
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
player.setJailed(false);
|
||||
player.setJailTimeout(0);
|
||||
player.sendMessage(tl("jailReleasedPlayerNotify"));
|
||||
player.setJail(null);
|
||||
if (player.getBase().isOnline()) {
|
||||
player.getTeleport().back();
|
||||
final User controller = sender.isPlayer() ? ess.getUser(sender.getPlayer()) : null;
|
||||
final JailStatusChangeEvent event = new JailStatusChangeEvent(player, controller, false);
|
||||
ess.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
player.setJailed(false);
|
||||
player.setJailTimeout(0);
|
||||
player.sendMessage(tl("jailReleasedPlayerNotify"));
|
||||
player.setJail(null);
|
||||
if (player.getBase().isOnline()) {
|
||||
player.getTeleport().back();
|
||||
}
|
||||
sender.sendMessage(tl("jailReleased", player.getName()));
|
||||
}
|
||||
sender.sendMessage(tl("jailReleased", player.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -250,6 +250,10 @@ player-commands:
|
||||
- worth
|
||||
- xmpp
|
||||
|
||||
# When this option is enabled, one-time use kits (ie. delay < 0) will be
|
||||
# removed from the /kit list when a player can no longer use it
|
||||
skip-used-one-time-kits-from-kit-list: false
|
||||
|
||||
# Note: All items MUST be followed by a quantity!
|
||||
# All kit names should be lower case, and will be treated as lower in permissions/costs.
|
||||
# Syntax: - itemID[:DataValue/Durability] Amount [Enchantment:Level].. [itemmeta:value]...
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.world.PortalCreateEvent;
|
||||
|
||||
|
||||
public class EssentialsProtectBlockListener implements Listener {
|
||||
@ -77,4 +78,11 @@ public class EssentialsProtectBlockListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPortalLight(PortalCreateEvent event) {
|
||||
if (event.getReason() == PortalCreateEvent.CreateReason.FIRE) {
|
||||
event.setCancelled(prot.getSettingBool(ProtectConfig.prevent_portal_creation));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user