Add 1.14 compatibility
This commit is contained in:
parent
85194fa94d
commit
5b97841699
@ -1,5 +1,5 @@
|
|||||||
<!-- AUTO-GENERATED FILE! Do not edit this directly -->
|
<!-- AUTO-GENERATED FILE! Do not edit this directly -->
|
||||||
<!-- File auto-generated on Fri Apr 19 17:16:04 CEST 2019. See docs/config/config.tpl.md -->
|
<!-- File auto-generated on Tue Apr 23 17:17:02 CEST 2019. See docs/config/config.tpl.md -->
|
||||||
|
|
||||||
## AuthMe Configuration
|
## AuthMe Configuration
|
||||||
The first time you run AuthMe it will create a config.yml file in the plugins/AuthMe folder,
|
The first time you run AuthMe it will create a config.yml file in the plugins/AuthMe folder,
|
||||||
@ -128,6 +128,8 @@ settings:
|
|||||||
# but it is incompatible with any permission plugin not included in our compatibility list.
|
# but it is incompatible with any permission plugin not included in our compatibility list.
|
||||||
# If you have issues with permission checks on player join please disable this option.
|
# If you have issues with permission checks on player join please disable this option.
|
||||||
useAsyncPreLoginEvent: true
|
useAsyncPreLoginEvent: true
|
||||||
|
# The name of the server, used in some placeholders.
|
||||||
|
serverName: Your Minecraft Server
|
||||||
restrictions:
|
restrictions:
|
||||||
# Can not authenticated players chat?
|
# Can not authenticated players chat?
|
||||||
# Keep in mind that this feature also blocks all commands not
|
# Keep in mind that this feature also blocks all commands not
|
||||||
@ -576,4 +578,4 @@ To change settings on a running server, save your changes to config.yml and use
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
This page was automatically generated on the [AuthMe/AuthMeReloaded repository](https://github.com/AuthMe/AuthMeReloaded/tree/master/docs/) on Fri Apr 19 17:16:04 CEST 2019
|
This page was automatically generated on the [AuthMe/AuthMeReloaded repository](https://github.com/AuthMe/AuthMeReloaded/tree/master/docs/) on Tue Apr 23 17:17:02 CEST 2019
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@ -64,7 +64,7 @@
|
|||||||
<maven.minimumVersion>3.3.9</maven.minimumVersion>
|
<maven.minimumVersion>3.3.9</maven.minimumVersion>
|
||||||
|
|
||||||
<!-- Dependencies versions -->
|
<!-- Dependencies versions -->
|
||||||
<spigot.version>1.13.2-R0.1-SNAPSHOT</spigot.version>
|
<spigot.version>1.14-pre5-SNAPSHOT</spigot.version>
|
||||||
|
|
||||||
<!-- Versioning properties -->
|
<!-- Versioning properties -->
|
||||||
<project.outputName>AuthMe</project.outputName>
|
<project.outputName>AuthMe</project.outputName>
|
||||||
|
|||||||
@ -36,7 +36,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.InventoryView;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -391,12 +391,12 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInventoryWhitelisted(Inventory inventory) {
|
private boolean isInventoryWhitelisted(InventoryView inventory) {
|
||||||
if (inventory == null) {
|
if (inventory == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Set<String> whitelist = settings.getProperty(RestrictionSettings.UNRESTRICTED_INVENTORIES);
|
Set<String> whitelist = settings.getProperty(RestrictionSettings.UNRESTRICTED_INVENTORIES);
|
||||||
return whitelist.contains(ChatColor.stripColor(inventory.getName()));
|
return whitelist.contains(ChatColor.stripColor(inventory.getTitle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
@ -404,7 +404,7 @@ public class PlayerListener implements Listener {
|
|||||||
final HumanEntity player = event.getPlayer();
|
final HumanEntity player = event.getPlayer();
|
||||||
|
|
||||||
if (listenerService.shouldCancelEvent(player)
|
if (listenerService.shouldCancelEvent(player)
|
||||||
&& !isInventoryWhitelisted(event.getInventory())) {
|
&& !isInventoryWhitelisted(event.getView())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -418,7 +418,7 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerInventoryClick(InventoryClickEvent event) {
|
public void onPlayerInventoryClick(InventoryClickEvent event) {
|
||||||
if (listenerService.shouldCancelEvent(event.getWhoClicked())
|
if (listenerService.shouldCancelEvent(event.getWhoClicked())
|
||||||
&& !isInventoryWhitelisted(event.getClickedInventory())) {
|
&& !isInventoryWhitelisted(event.getView())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,11 +4,11 @@ import fr.xephi.authme.ConsoleLogger;
|
|||||||
import fr.xephi.authme.initialization.DataFolder;
|
import fr.xephi.authme.initialization.DataFolder;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.settings.properties.EmailSettings;
|
import fr.xephi.authme.settings.properties.EmailSettings;
|
||||||
|
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
import fr.xephi.authme.util.FileUtils;
|
import fr.xephi.authme.util.FileUtils;
|
||||||
import org.apache.commons.mail.EmailException;
|
import org.apache.commons.mail.EmailException;
|
||||||
import org.apache.commons.mail.HtmlEmail;
|
import org.apache.commons.mail.HtmlEmail;
|
||||||
import org.bukkit.Server;
|
|
||||||
|
|
||||||
import javax.activation.DataSource;
|
import javax.activation.DataSource;
|
||||||
import javax.activation.FileDataSource;
|
import javax.activation.FileDataSource;
|
||||||
@ -23,14 +23,12 @@ import java.io.IOException;
|
|||||||
public class EmailService {
|
public class EmailService {
|
||||||
|
|
||||||
private final File dataFolder;
|
private final File dataFolder;
|
||||||
private final String serverName;
|
|
||||||
private final Settings settings;
|
private final Settings settings;
|
||||||
private final SendMailSsl sendMailSsl;
|
private final SendMailSsl sendMailSsl;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
EmailService(@DataFolder File dataFolder, Server server, Settings settings, SendMailSsl sendMailSsl) {
|
EmailService(@DataFolder File dataFolder, Settings settings, SendMailSsl sendMailSsl) {
|
||||||
this.dataFolder = dataFolder;
|
this.dataFolder = dataFolder;
|
||||||
this.serverName = server.getServerName();
|
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
this.sendMailSsl = sendMailSsl;
|
this.sendMailSsl = sendMailSsl;
|
||||||
}
|
}
|
||||||
@ -146,14 +144,14 @@ public class EmailService {
|
|||||||
private String replaceTagsForPasswordMail(String mailText, String name, String newPass) {
|
private String replaceTagsForPasswordMail(String mailText, String name, String newPass) {
|
||||||
return mailText
|
return mailText
|
||||||
.replace("<playername />", name)
|
.replace("<playername />", name)
|
||||||
.replace("<servername />", serverName)
|
.replace("<servername />", settings.getProperty(PluginSettings.SERVER_NAME))
|
||||||
.replace("<generatedpass />", newPass);
|
.replace("<generatedpass />", newPass);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String replaceTagsForVerificationEmail(String mailText, String name, String code, int minutesValid) {
|
private String replaceTagsForVerificationEmail(String mailText, String name, String code, int minutesValid) {
|
||||||
return mailText
|
return mailText
|
||||||
.replace("<playername />", name)
|
.replace("<playername />", name)
|
||||||
.replace("<servername />", serverName)
|
.replace("<servername />", settings.getProperty(PluginSettings.SERVER_NAME))
|
||||||
.replace("<generatedcode />", code)
|
.replace("<generatedcode />", code)
|
||||||
.replace("<minutesvalid />", String.valueOf(minutesValid));
|
.replace("<minutesvalid />", String.valueOf(minutesValid));
|
||||||
}
|
}
|
||||||
@ -161,7 +159,7 @@ public class EmailService {
|
|||||||
private String replaceTagsForRecoveryCodeMail(String mailText, String name, String code, int hoursValid) {
|
private String replaceTagsForRecoveryCodeMail(String mailText, String name, String code, int hoursValid) {
|
||||||
return mailText
|
return mailText
|
||||||
.replace("<playername />", name)
|
.replace("<playername />", name)
|
||||||
.replace("<servername />", serverName)
|
.replace("<servername />", settings.getProperty(PluginSettings.SERVER_NAME))
|
||||||
.replace("<recoverycode />", code)
|
.replace("<recoverycode />", code)
|
||||||
.replace("<hoursvalid />", String.valueOf(hoursValid));
|
.replace("<hoursvalid />", String.valueOf(hoursValid));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,6 @@ import org.bukkit.scheduler.BukkitScheduler;
|
|||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -37,7 +36,6 @@ public class BukkitService implements SettingsDependent {
|
|||||||
public static final int TICKS_PER_MINUTE = 60 * TICKS_PER_SECOND;
|
public static final int TICKS_PER_MINUTE = 60 * TICKS_PER_SECOND;
|
||||||
|
|
||||||
private final AuthMe authMe;
|
private final AuthMe authMe;
|
||||||
private Method getOnlinePlayers;
|
|
||||||
private boolean useAsyncTasks;
|
private boolean useAsyncTasks;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import fr.xephi.authme.initialization.Reloadable;
|
|||||||
import fr.xephi.authme.service.BukkitService;
|
import fr.xephi.authme.service.BukkitService;
|
||||||
import fr.xephi.authme.service.CommonService;
|
import fr.xephi.authme.service.CommonService;
|
||||||
import fr.xephi.authme.service.GeoIpService;
|
import fr.xephi.authme.service.GeoIpService;
|
||||||
|
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||||
import fr.xephi.authme.util.PlayerUtils;
|
import fr.xephi.authme.util.PlayerUtils;
|
||||||
import fr.xephi.authme.util.lazytags.Tag;
|
import fr.xephi.authme.util.lazytags.Tag;
|
||||||
@ -65,7 +66,7 @@ public class WelcomeMessageConfiguration implements Reloadable {
|
|||||||
createTag("{IP}", PlayerUtils::getPlayerIp),
|
createTag("{IP}", PlayerUtils::getPlayerIp),
|
||||||
createTag("{LOGINS}", () -> Integer.toString(playerCache.getLogged())),
|
createTag("{LOGINS}", () -> Integer.toString(playerCache.getLogged())),
|
||||||
createTag("{WORLD}", pl -> pl.getWorld().getName()),
|
createTag("{WORLD}", pl -> pl.getWorld().getName()),
|
||||||
createTag("{SERVER}", () -> server.getServerName()),
|
createTag("{SERVER}", () -> service.getProperty(PluginSettings.SERVER_NAME)),
|
||||||
createTag("{VERSION}", () -> server.getBukkitVersion()),
|
createTag("{VERSION}", () -> server.getBukkitVersion()),
|
||||||
createTag("{COUNTRY}", pl -> geoIpService.getCountryName(PlayerUtils.getPlayerIp(pl))));
|
createTag("{COUNTRY}", pl -> geoIpService.getCountryName(PlayerUtils.getPlayerIp(pl))));
|
||||||
|
|
||||||
|
|||||||
@ -90,6 +90,9 @@ public final class PluginSettings implements SettingsHolder {
|
|||||||
public static final Property<Boolean> USE_ASYNC_PRE_LOGIN_EVENT =
|
public static final Property<Boolean> USE_ASYNC_PRE_LOGIN_EVENT =
|
||||||
newProperty("settings.useAsyncPreLoginEvent", true);
|
newProperty("settings.useAsyncPreLoginEvent", true);
|
||||||
|
|
||||||
|
@Comment("The name of the server, used in some placeholders.")
|
||||||
|
public static final Property<String> SERVER_NAME = newProperty("settings.serverName", "Your Minecraft Server");
|
||||||
|
|
||||||
private PluginSettings() {
|
private PluginSettings() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ website: ${project.url}
|
|||||||
description: ${project.description}
|
description: ${project.description}
|
||||||
main: ${pluginDescription.main}
|
main: ${pluginDescription.main}
|
||||||
version: ${pluginDescription.version}
|
version: ${pluginDescription.version}
|
||||||
api-version: 1.13
|
api-version: 1.14
|
||||||
softdepend:
|
softdepend:
|
||||||
- Vault
|
- Vault
|
||||||
- LuckPerms
|
- LuckPerms
|
||||||
|
|||||||
@ -786,6 +786,7 @@ public class PlayerListenerTest {
|
|||||||
// given
|
// given
|
||||||
HumanEntity player = mock(Player.class);
|
HumanEntity player = mock(Player.class);
|
||||||
InventoryView transaction = mock(InventoryView.class);
|
InventoryView transaction = mock(InventoryView.class);
|
||||||
|
given(settings.getProperty(RestrictionSettings.UNRESTRICTED_INVENTORIES)).willReturn(Collections.emptySet());
|
||||||
given(transaction.getPlayer()).willReturn(player);
|
given(transaction.getPlayer()).willReturn(player);
|
||||||
InventoryOpenEvent event = new InventoryOpenEvent(transaction);
|
InventoryOpenEvent event = new InventoryOpenEvent(transaction);
|
||||||
given(event.getPlayer()).willReturn(player);
|
given(event.getPlayer()).willReturn(player);
|
||||||
|
|||||||
@ -7,10 +7,10 @@ import fr.xephi.authme.TestHelper;
|
|||||||
import fr.xephi.authme.initialization.DataFolder;
|
import fr.xephi.authme.initialization.DataFolder;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.settings.properties.EmailSettings;
|
import fr.xephi.authme.settings.properties.EmailSettings;
|
||||||
|
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
import org.apache.commons.mail.EmailException;
|
import org.apache.commons.mail.EmailException;
|
||||||
import org.apache.commons.mail.HtmlEmail;
|
import org.apache.commons.mail.HtmlEmail;
|
||||||
import org.bukkit.Server;
|
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -46,8 +46,6 @@ public class EmailServiceTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private Settings settings;
|
private Settings settings;
|
||||||
@Mock
|
@Mock
|
||||||
private Server server;
|
|
||||||
@Mock
|
|
||||||
private SendMailSsl sendMailSsl;
|
private SendMailSsl sendMailSsl;
|
||||||
@DataFolder
|
@DataFolder
|
||||||
private File dataFolder;
|
private File dataFolder;
|
||||||
@ -63,7 +61,7 @@ public class EmailServiceTest {
|
|||||||
@BeforeInjecting
|
@BeforeInjecting
|
||||||
public void initFields() throws IOException {
|
public void initFields() throws IOException {
|
||||||
dataFolder = temporaryFolder.newFolder();
|
dataFolder = temporaryFolder.newFolder();
|
||||||
given(server.getServerName()).willReturn("serverName");
|
given(settings.getProperty(PluginSettings.SERVER_NAME)).willReturn("serverName");
|
||||||
given(settings.getProperty(EmailSettings.MAIL_ACCOUNT)).willReturn("mail@example.org");
|
given(settings.getProperty(EmailSettings.MAIL_ACCOUNT)).willReturn("mail@example.org");
|
||||||
given(settings.getProperty(EmailSettings.MAIL_PASSWORD)).willReturn("pass1234");
|
given(settings.getProperty(EmailSettings.MAIL_PASSWORD)).willReturn("pass1234");
|
||||||
given(sendMailSsl.hasAllInformation()).willReturn(true);
|
given(sendMailSsl.hasAllInformation()).willReturn(true);
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import fr.xephi.authme.initialization.DataFolder;
|
|||||||
import fr.xephi.authme.service.BukkitService;
|
import fr.xephi.authme.service.BukkitService;
|
||||||
import fr.xephi.authme.service.CommonService;
|
import fr.xephi.authme.service.CommonService;
|
||||||
import fr.xephi.authme.service.GeoIpService;
|
import fr.xephi.authme.service.GeoIpService;
|
||||||
|
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -96,7 +97,7 @@ public class WelcomeMessageConfigurationTest {
|
|||||||
given(player.getName()).willReturn("Bobby");
|
given(player.getName()).willReturn("Bobby");
|
||||||
TestHelper.mockPlayerIp(player, "123.45.66.77");
|
TestHelper.mockPlayerIp(player, "123.45.66.77");
|
||||||
given(geoIpService.getCountryName("123.45.66.77")).willReturn("Syldavia");
|
given(geoIpService.getCountryName("123.45.66.77")).willReturn("Syldavia");
|
||||||
given(server.getServerName()).willReturn("CrazyServer");
|
given(service.getProperty(PluginSettings.SERVER_NAME)).willReturn("CrazyServer");
|
||||||
|
|
||||||
// when
|
// when
|
||||||
List<String> result = welcomeMessageConfiguration.getWelcomeMessage(player);
|
List<String> result = welcomeMessageConfiguration.getWelcomeMessage(player);
|
||||||
@ -106,8 +107,7 @@ public class WelcomeMessageConfigurationTest {
|
|||||||
assertThat(result.get(0), equalTo("Hello Bobby, your IP is 123.45.66.77"));
|
assertThat(result.get(0), equalTo("Hello Bobby, your IP is 123.45.66.77"));
|
||||||
assertThat(result.get(1), equalTo("Your country is Syldavia."));
|
assertThat(result.get(1), equalTo("Your country is Syldavia."));
|
||||||
assertThat(result.get(2), equalTo("Welcome to CrazyServer!"));
|
assertThat(result.get(2), equalTo("Welcome to CrazyServer!"));
|
||||||
verify(server, only()).getServerName();
|
verifyZeroInteractions(server, playerCache);
|
||||||
verifyZeroInteractions(playerCache);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user