mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-12 03:13:37 +01:00
Merge branch 'master' into release
This commit is contained in:
commit
8042cefd3d
@ -66,6 +66,7 @@ endorsed.classpath=
|
|||||||
excludes=
|
excludes=
|
||||||
file.reference.BOSEconomy7.jar=../lib/BOSEconomy7.jar
|
file.reference.BOSEconomy7.jar=../lib/BOSEconomy7.jar
|
||||||
file.reference.bPermissions.jar=../lib/bPermissions.jar
|
file.reference.bPermissions.jar=../lib/bPermissions.jar
|
||||||
|
file.reference.bpermissions2.jar=../lib/bpermissions2.jar
|
||||||
file.reference.bukkit.jar=../lib/bukkit.jar
|
file.reference.bukkit.jar=../lib/bukkit.jar
|
||||||
file.reference.craftbukkit.jar=../lib/craftbukkit.jar
|
file.reference.craftbukkit.jar=../lib/craftbukkit.jar
|
||||||
file.reference.iCo4.jar=../lib/iCo4.jar
|
file.reference.iCo4.jar=../lib/iCo4.jar
|
||||||
@ -97,7 +98,8 @@ javac.classpath=\
|
|||||||
${file.reference.bukkit.jar}:\
|
${file.reference.bukkit.jar}:\
|
||||||
${file.reference.craftbukkit.jar}:\
|
${file.reference.craftbukkit.jar}:\
|
||||||
${file.reference.Vault.jar}:\
|
${file.reference.Vault.jar}:\
|
||||||
${file.reference.Privileges.jar}
|
${file.reference.Privileges.jar}:\
|
||||||
|
${file.reference.bpermissions2.jar}
|
||||||
# Space-separated list of extra javac options
|
# Space-separated list of extra javac options
|
||||||
javac.compilerargs=
|
javac.compilerargs=
|
||||||
javac.deprecation=false
|
javac.deprecation=false
|
||||||
|
@ -2,6 +2,7 @@ package com.earth2me.essentials;
|
|||||||
|
|
||||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||||
import com.earth2me.essentials.signs.EssentialsSign;
|
import com.earth2me.essentials.signs.EssentialsSign;
|
||||||
|
import com.earth2me.essentials.textreader.IText;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -14,9 +15,7 @@ public interface ISettings extends IConf
|
|||||||
{
|
{
|
||||||
boolean areSignsDisabled();
|
boolean areSignsDisabled();
|
||||||
|
|
||||||
String format(String format, IUser user);
|
IText getAnnounceNewPlayerFormat();
|
||||||
|
|
||||||
String getAnnounceNewPlayerFormat(IUser user);
|
|
||||||
|
|
||||||
boolean getAnnounceNewPlayers();
|
boolean getAnnounceNewPlayers();
|
||||||
|
|
||||||
|
@ -4,6 +4,10 @@ import static com.earth2me.essentials.I18n._;
|
|||||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||||
import com.earth2me.essentials.signs.EssentialsSign;
|
import com.earth2me.essentials.signs.EssentialsSign;
|
||||||
import com.earth2me.essentials.signs.Signs;
|
import com.earth2me.essentials.signs.Signs;
|
||||||
|
import com.earth2me.essentials.textreader.IText;
|
||||||
|
import com.earth2me.essentials.textreader.KeywordReplacer;
|
||||||
|
import com.earth2me.essentials.textreader.SimpleTextInput;
|
||||||
|
import com.earth2me.essentials.textreader.SimpleTextPager;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -324,15 +328,9 @@ public class Settings implements ISettings
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAnnounceNewPlayerFormat(IUser user)
|
public IText getAnnounceNewPlayerFormat()
|
||||||
{
|
{
|
||||||
return format(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!"), user);
|
return new SimpleTextInput(Util.replaceColor(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!")));
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String format(String format, IUser user)
|
|
||||||
{
|
|
||||||
return format.replace('&', '§').replace("§§", "&").replace("{PLAYER}", user.getDisplayName()).replace("{DISPLAYNAME}", user.getDisplayName()).replace("{GROUP}", user.getGroup()).replace("{USERNAME}", user.getName()).replace("{ADDRESS}", user.getAddress().toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -362,7 +360,6 @@ public class Settings implements ISettings
|
|||||||
itemSpawnBl = getItemSpawnBlacklist();
|
itemSpawnBl = getItemSpawnBlacklist();
|
||||||
chatFormats.clear();
|
chatFormats.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -374,7 +371,8 @@ public class Settings implements ISettings
|
|||||||
private List<Integer> getItemSpawnBlacklist()
|
private List<Integer> getItemSpawnBlacklist()
|
||||||
{
|
{
|
||||||
final List<Integer> epItemSpwn = new ArrayList<Integer>();
|
final List<Integer> epItemSpwn = new ArrayList<Integer>();
|
||||||
if (ess.getItemDb() == null) {
|
if (ess.getItemDb() == null)
|
||||||
|
{
|
||||||
logger.log(Level.FINE, "Aborting ItemSpawnBL read, itemDB not yet loaded.");
|
logger.log(Level.FINE, "Aborting ItemSpawnBL read, itemDB not yet loaded.");
|
||||||
return epItemSpwn;
|
return epItemSpwn;
|
||||||
}
|
}
|
||||||
@ -397,7 +395,6 @@ public class Settings implements ISettings
|
|||||||
}
|
}
|
||||||
return epItemSpwn;
|
return epItemSpwn;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<EssentialsSign> enabledSigns = new ArrayList<EssentialsSign>();
|
private List<EssentialsSign> enabledSigns = new ArrayList<EssentialsSign>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -604,7 +601,6 @@ public class Settings implements ISettings
|
|||||||
{
|
{
|
||||||
return config.getBoolean("death-messages", true);
|
return config.getBoolean("death-messages", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<String> noGodWorlds = new HashSet<String>();
|
private Set<String> noGodWorlds = new HashSet<String>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,5 +20,6 @@ public class Commandback extends EssentialsCommand
|
|||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
user.sendMessage(_("backUsageMsg"));
|
user.sendMessage(_("backUsageMsg"));
|
||||||
user.getTeleport().back(charge);
|
user.getTeleport().back(charge);
|
||||||
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,62 @@
|
|||||||
|
package com.earth2me.essentials.perm;
|
||||||
|
|
||||||
|
import de.bananaco.bpermissions.api.ApiLayer;
|
||||||
|
import de.bananaco.bpermissions.api.World;
|
||||||
|
import de.bananaco.bpermissions.api.WorldManager;
|
||||||
|
import de.bananaco.bpermissions.api.util.Calculable;
|
||||||
|
import de.bananaco.bpermissions.api.util.CalculableType;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
|
public class BPermissions2Handler extends SuperpermsHandler
|
||||||
|
{
|
||||||
|
public BPermissions2Handler()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getGroup(final Player base)
|
||||||
|
{
|
||||||
|
final List<String> groups = getGroups(base);
|
||||||
|
if (groups == null || groups.isEmpty())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return groups.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getGroups(final Player base)
|
||||||
|
{
|
||||||
|
final String[] groups = ApiLayer.getGroups(base.getWorld().getName(), CalculableType.USER, base.getName());
|
||||||
|
return Arrays.asList(groups);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean inGroup(final Player base, final String group)
|
||||||
|
{
|
||||||
|
return ApiLayer.hasGroup(base.getWorld().getName(), CalculableType.USER, base.getName(), group);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canBuild(final Player base, final String group)
|
||||||
|
{
|
||||||
|
return hasPermission(base, "essentials.build") || hasPermission(base, "bPermissions.build");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPrefix(final Player base)
|
||||||
|
{
|
||||||
|
return ApiLayer.getValue(base.getWorld().getName(), CalculableType.USER, base.getName(), "prefix");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSuffix(final Player base)
|
||||||
|
{
|
||||||
|
return ApiLayer.getValue(base.getWorld().getName(), CalculableType.USER, base.getName(), "suffix");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials.perm;
|
package com.earth2me.essentials.perm;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.Util;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@ -111,17 +112,6 @@ public class PermissionsHandler implements IPermissionsHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Plugin bPermPlugin = pluginManager.getPlugin("bPermissions");
|
|
||||||
if (bPermPlugin != null && bPermPlugin.isEnabled())
|
|
||||||
{
|
|
||||||
if (!(handler instanceof BPermissionsHandler))
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.INFO, "Essentials: Using bPermissions based permissions.");
|
|
||||||
handler = new BPermissionsHandler();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Plugin GMplugin = pluginManager.getPlugin("GroupManager");
|
final Plugin GMplugin = pluginManager.getPlugin("GroupManager");
|
||||||
if (GMplugin != null && GMplugin.isEnabled())
|
if (GMplugin != null && GMplugin.isEnabled())
|
||||||
{
|
{
|
||||||
@ -155,6 +145,27 @@ public class PermissionsHandler implements IPermissionsHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Plugin bPermPlugin = pluginManager.getPlugin("bPermissions");
|
||||||
|
if (bPermPlugin != null && bPermPlugin.isEnabled())
|
||||||
|
{
|
||||||
|
final String bVer = bPermPlugin.getDescription().getVersion().replace(".", "");
|
||||||
|
if (Util.isInt(bVer) && Integer.parseInt(bVer) < 284)
|
||||||
|
{
|
||||||
|
if (!(handler instanceof BPermissionsHandler))
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.INFO, "Essentials: Using bPermissions based permissions.");
|
||||||
|
handler = new BPermissionsHandler();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(handler instanceof BPermissions2Handler))
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.INFO, "Essentials: Using bPermissions2 based permissions.");
|
||||||
|
handler = new BPermissions2Handler();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
final Plugin permPlugin = pluginManager.getPlugin("Permissions");
|
final Plugin permPlugin = pluginManager.getPlugin("Permissions");
|
||||||
if (permPlugin != null && permPlugin.isEnabled())
|
if (permPlugin != null && permPlugin.isEnabled())
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ public class SuperpermsHandler implements IPermissionsHandler
|
|||||||
@Override
|
@Override
|
||||||
public boolean inGroup(final Player base, final String group)
|
public boolean inGroup(final Player base, final String group)
|
||||||
{
|
{
|
||||||
return false;
|
return hasPermission(base, "group." + group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,12 +33,14 @@ public class KeywordReplacer implements IText
|
|||||||
String displayName, ipAddress, balance, mails, world;
|
String displayName, ipAddress, balance, mails, world;
|
||||||
String worlds, online, unique, playerlist, date, time;
|
String worlds, online, unique, playerlist, date, time;
|
||||||
String worldTime12, worldTime24, worldDate, plugins;
|
String worldTime12, worldTime24, worldDate, plugins;
|
||||||
String version;
|
String userName, address, version;
|
||||||
if (sender instanceof Player)
|
if (sender instanceof Player)
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(sender);
|
final User user = ess.getUser(sender);
|
||||||
displayName = user.getDisplayName();
|
displayName = user.getDisplayName();
|
||||||
|
userName = user.getName();
|
||||||
ipAddress = user.getAddress().getAddress().toString();
|
ipAddress = user.getAddress().getAddress().toString();
|
||||||
|
address = user.getAddress().toString();
|
||||||
balance = Double.toString(user.getMoney());
|
balance = Double.toString(user.getMoney());
|
||||||
mails = Integer.toString(user.getMails().size());
|
mails = Integer.toString(user.getMails().size());
|
||||||
world = user.getLocation().getWorld().getName();
|
world = user.getLocation().getWorld().getName();
|
||||||
@ -107,8 +109,12 @@ public class KeywordReplacer implements IText
|
|||||||
for (int i = 0; i < input.getLines().size(); i++)
|
for (int i = 0; i < input.getLines().size(); i++)
|
||||||
{
|
{
|
||||||
String line = input.getLines().get(i);
|
String line = input.getLines().get(i);
|
||||||
|
|
||||||
line = line.replace("{PLAYER}", displayName);
|
line = line.replace("{PLAYER}", displayName);
|
||||||
|
line = line.replace("{DISPLAYNAME}", displayName);
|
||||||
|
line = line.replace("{USERNAME}", displayName);
|
||||||
line = line.replace("{IP}", ipAddress);
|
line = line.replace("{IP}", ipAddress);
|
||||||
|
line = line.replace("{ADDRESS}", ipAddress);
|
||||||
line = line.replace("{BALANCE}", balance);
|
line = line.replace("{BALANCE}", balance);
|
||||||
line = line.replace("{MAILS}", mails);
|
line = line.replace("{MAILS}", mails);
|
||||||
line = line.replace("{WORLD}", world);
|
line = line.replace("{WORLD}", world);
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
package com.earth2me.essentials.textreader;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
public class SimpleTextInput implements IText
|
||||||
|
{
|
||||||
|
private final transient List<String> lines = new ArrayList<String>();
|
||||||
|
|
||||||
|
public SimpleTextInput (final String input) {
|
||||||
|
lines.add(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getLines()
|
||||||
|
{
|
||||||
|
return lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getChapters()
|
||||||
|
{
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Integer> getBookmarks()
|
||||||
|
{
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.earth2me.essentials.textreader;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
|
||||||
|
public class SimpleTextPager
|
||||||
|
{
|
||||||
|
private final transient IText text;
|
||||||
|
|
||||||
|
public SimpleTextPager(final IText text)
|
||||||
|
{
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showPage(final CommandSender sender)
|
||||||
|
{
|
||||||
|
for (String line : text.getLines())
|
||||||
|
{
|
||||||
|
sender.sendMessage(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getString(int line)
|
||||||
|
{
|
||||||
|
if (text.getLines().size() < line)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return text.getLines().get(line);
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,10 @@ Name it info_username.txt or info_groupname.txt
|
|||||||
|
|
||||||
This also works with motd and rules.
|
This also works with motd and rules.
|
||||||
|
|
||||||
|
Extra pages:
|
||||||
|
Type /info Colours
|
||||||
|
Type /info Tags
|
||||||
|
|
||||||
It can contain chapters like the Chapter1 below:
|
It can contain chapters like the Chapter1 below:
|
||||||
|
|
||||||
#Chapter1
|
#Chapter1
|
||||||
@ -25,7 +29,9 @@ Minecraft colors:
|
|||||||
|
|
||||||
#Tags
|
#Tags
|
||||||
PLAYER: {PLAYER}
|
PLAYER: {PLAYER}
|
||||||
|
USERNAME: {PLAYER}
|
||||||
IP: {IP}
|
IP: {IP}
|
||||||
|
ADDRESS: {ADDRESS}
|
||||||
BALANCE: {BALANCE}
|
BALANCE: {BALANCE}
|
||||||
MAILS: {MAILS}
|
MAILS: {MAILS}
|
||||||
WORLD: {WORLD}
|
WORLD: {WORLD}
|
||||||
@ -39,3 +45,4 @@ WORLDTIME12: {WORLDTIME12}
|
|||||||
WORLDTIME24: {WORLDTIME24}
|
WORLDTIME24: {WORLDTIME24}
|
||||||
WORLDDATE: {WORLDDATE}
|
WORLDDATE: {WORLDDATE}
|
||||||
PLUGINS: {PLUGINS}
|
PLUGINS: {PLUGINS}
|
||||||
|
VERSION: {VERSION}
|
@ -4,6 +4,9 @@ import static com.earth2me.essentials.I18n._;
|
|||||||
import com.earth2me.essentials.IEssentials;
|
import com.earth2me.essentials.IEssentials;
|
||||||
import com.earth2me.essentials.OfflinePlayer;
|
import com.earth2me.essentials.OfflinePlayer;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
|
import com.earth2me.essentials.textreader.IText;
|
||||||
|
import com.earth2me.essentials.textreader.KeywordReplacer;
|
||||||
|
import com.earth2me.essentials.textreader.SimpleTextPager;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -73,7 +76,9 @@ public class EssentialsSpawnPlayerListener implements Listener
|
|||||||
|
|
||||||
if (ess.getSettings().getAnnounceNewPlayers())
|
if (ess.getSettings().getAnnounceNewPlayers())
|
||||||
{
|
{
|
||||||
ess.broadcastMessage(user, ess.getSettings().getAnnounceNewPlayerFormat(user));
|
final IText output = new KeywordReplacer(ess.getSettings().getAnnounceNewPlayerFormat(), user, ess);
|
||||||
|
final SimpleTextPager pager = new SimpleTextPager(output);
|
||||||
|
ess.broadcastMessage(user, pager.getString(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.log(Level.FINE, "New player join");
|
LOGGER.log(Level.FINE, "New player join");
|
||||||
|
BIN
lib/bpermissions2.jar
Normal file
BIN
lib/bpermissions2.jar
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user