mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-29 05:55:48 +01:00
Fix merge conflicts
This commit is contained in:
commit
03d1b3682d
10
pom.xml
10
pom.xml
@ -219,7 +219,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.2.4</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
@ -272,13 +272,19 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>se.eris</groupId>
|
<groupId>se.eris</groupId>
|
||||||
<artifactId>notnull-instrumenter-maven-plugin</artifactId>
|
<artifactId>notnull-instrumenter-maven-plugin</artifactId>
|
||||||
<version>0.6.8</version>
|
<version>1.0.0</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>instrument</goal>
|
<goal>instrument</goal>
|
||||||
<goal>tests-instrument</goal>
|
<goal>tests-instrument</goal>
|
||||||
</goals>
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<notNull>
|
||||||
|
<param>org.jetbrains.annotations.NotNull</param>
|
||||||
|
<param>javax.validation.constraints.NotNull</param>
|
||||||
|
</notNull>
|
||||||
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
@ -39,6 +39,7 @@ import com.onarandombox.MultiverseCore.listeners.MVWeatherListener;
|
|||||||
import com.onarandombox.MultiverseCore.listeners.MVWorldInitListener;
|
import com.onarandombox.MultiverseCore.listeners.MVWorldInitListener;
|
||||||
import com.onarandombox.MultiverseCore.listeners.MVWorldListener;
|
import com.onarandombox.MultiverseCore.listeners.MVWorldListener;
|
||||||
import com.onarandombox.MultiverseCore.utils.AnchorManager;
|
import com.onarandombox.MultiverseCore.utils.AnchorManager;
|
||||||
|
import com.onarandombox.MultiverseCore.utils.CompatibilityLayer;
|
||||||
import com.onarandombox.MultiverseCore.utils.MVEconomist;
|
import com.onarandombox.MultiverseCore.utils.MVEconomist;
|
||||||
import com.onarandombox.MultiverseCore.utils.MVMessaging;
|
import com.onarandombox.MultiverseCore.utils.MVMessaging;
|
||||||
import com.onarandombox.MultiverseCore.utils.MVPermissions;
|
import com.onarandombox.MultiverseCore.utils.MVPermissions;
|
||||||
@ -216,6 +217,8 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
|||||||
// Setup our SafeTTeleporter
|
// Setup our SafeTTeleporter
|
||||||
this.safeTTeleporter = new SimpleSafeTTeleporter(this);
|
this.safeTTeleporter = new SimpleSafeTTeleporter(this);
|
||||||
this.unsafeCallWrapper = new UnsafeCallWrapper(this);
|
this.unsafeCallWrapper = new UnsafeCallWrapper(this);
|
||||||
|
// Setup our CompatibilityLayer
|
||||||
|
CompatibilityLayer.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -313,15 +316,18 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
|||||||
* Initializes the buscript javascript library.
|
* Initializes the buscript javascript library.
|
||||||
*/
|
*/
|
||||||
private void initializeBuscript() {
|
private void initializeBuscript() {
|
||||||
|
buscript = null;
|
||||||
|
|
||||||
|
if (this.getMVConfig().getEnableBuscript()) {
|
||||||
try {
|
try {
|
||||||
buscript = new Buscript(this);
|
buscript = new Buscript(this);
|
||||||
// Add global variable "multiverse" to javascript environment
|
// Add global variable "multiverse" to javascript environment
|
||||||
buscript.setScriptVariable("multiverse", this);
|
buscript.setScriptVariable("multiverse", this);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
buscript = null;
|
|
||||||
Logging.warning("Buscript failed to load! The script command will be disabled!");
|
Logging.warning("Buscript failed to load! The script command will be disabled!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void initializeDestinationFactory() {
|
private void initializeDestinationFactory() {
|
||||||
this.destFactory = new DestinationFactory(this);
|
this.destFactory = new DestinationFactory(this);
|
||||||
|
@ -56,6 +56,8 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
|||||||
@Property
|
@Property
|
||||||
private volatile boolean displaypermerrors;
|
private volatile boolean displaypermerrors;
|
||||||
@Property
|
@Property
|
||||||
|
private volatile boolean enablebuscript;
|
||||||
|
@Property
|
||||||
private volatile int globaldebug;
|
private volatile int globaldebug;
|
||||||
@Property
|
@Property
|
||||||
private volatile boolean silentstart;
|
private volatile boolean silentstart;
|
||||||
@ -99,6 +101,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
|||||||
teleportintercept = true;
|
teleportintercept = true;
|
||||||
firstspawnoverride = true;
|
firstspawnoverride = true;
|
||||||
displaypermerrors = true;
|
displaypermerrors = true;
|
||||||
|
enablebuscript = true;
|
||||||
globaldebug = 0;
|
globaldebug = 0;
|
||||||
messagecooldown = 5000;
|
messagecooldown = 5000;
|
||||||
teleportcooldown = 1000;
|
teleportcooldown = 1000;
|
||||||
@ -213,6 +216,22 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
|||||||
return this.displaypermerrors;
|
return this.displaypermerrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean getEnableBuscript() {
|
||||||
|
return this.enablebuscript;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setEnableBuscript(boolean enableBuscript) {
|
||||||
|
this.enablebuscript = enableBuscript;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@ -86,6 +86,18 @@ public interface MultiverseCoreConfig extends ConfigurationSerializable {
|
|||||||
*/
|
*/
|
||||||
boolean getDisplayPermErrors();
|
boolean getDisplayPermErrors();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets enableBuscript.
|
||||||
|
* @param enableBuscript The new value.
|
||||||
|
*/
|
||||||
|
void setEnableBuscript(boolean enableBuscript);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets enableBuscript.
|
||||||
|
* @return enableBuscript.
|
||||||
|
*/
|
||||||
|
boolean getEnableBuscript();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets firstSpawnOverride.
|
* Sets firstSpawnOverride.
|
||||||
* @param firstSpawnOverride The new value.
|
* @param firstSpawnOverride The new value.
|
||||||
|
@ -14,7 +14,6 @@ import co.aikar.commands.annotation.Description;
|
|||||||
import co.aikar.commands.annotation.Optional;
|
import co.aikar.commands.annotation.Optional;
|
||||||
import co.aikar.commands.annotation.Subcommand;
|
import co.aikar.commands.annotation.Subcommand;
|
||||||
import co.aikar.commands.annotation.Syntax;
|
import co.aikar.commands.annotation.Syntax;
|
||||||
import com.dumptruckman.minecraft.util.Logging;
|
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
|
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
|
||||||
import com.onarandombox.MultiverseCore.utils.webpaste.PasteFailedException;
|
import com.onarandombox.MultiverseCore.utils.webpaste.PasteFailedException;
|
||||||
@ -24,12 +23,9 @@ import com.onarandombox.MultiverseCore.utils.webpaste.PasteServiceType;
|
|||||||
import com.onarandombox.MultiverseCore.utils.webpaste.URLShortener;
|
import com.onarandombox.MultiverseCore.utils.webpaste.URLShortener;
|
||||||
import com.onarandombox.MultiverseCore.utils.webpaste.URLShortenerFactory;
|
import com.onarandombox.MultiverseCore.utils.webpaste.URLShortenerFactory;
|
||||||
import com.onarandombox.MultiverseCore.utils.webpaste.URLShortenerType;
|
import com.onarandombox.MultiverseCore.utils.webpaste.URLShortenerType;
|
||||||
import net.milkbowl.vault.chat.Chat;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@ -163,6 +159,7 @@ public class VersionCommand extends MultiverseCommand {
|
|||||||
+ "[Multiverse-Core] firstspawnoverride: " + this.plugin.getMVConfig().getFirstSpawnOverride() + '\n'
|
+ "[Multiverse-Core] firstspawnoverride: " + this.plugin.getMVConfig().getFirstSpawnOverride() + '\n'
|
||||||
+ "[Multiverse-Core] displaypermerrors: " + this.plugin.getMVConfig().getDisplayPermErrors() + '\n'
|
+ "[Multiverse-Core] displaypermerrors: " + this.plugin.getMVConfig().getDisplayPermErrors() + '\n'
|
||||||
+ "[Multiverse-Core] globaldebug: " + this.plugin.getMVConfig().getGlobalDebug() + '\n'
|
+ "[Multiverse-Core] globaldebug: " + this.plugin.getMVConfig().getGlobalDebug() + '\n'
|
||||||
|
+ "[Multiverse-Core] enablebuscript: " + plugin.getMVConfig().getEnableBuscript() + '\n'
|
||||||
+ "[Multiverse-Core] silentstart: " + this.plugin.getMVConfig().getSilentStart() + '\n'
|
+ "[Multiverse-Core] silentstart: " + this.plugin.getMVConfig().getSilentStart() + '\n'
|
||||||
+ "[Multiverse-Core] messagecooldown: " + this.plugin.getMessaging().getCooldown() + '\n'
|
+ "[Multiverse-Core] messagecooldown: " + this.plugin.getMessaging().getCooldown() + '\n'
|
||||||
+ "[Multiverse-Core] version: " + this.plugin.getMVConfig().getVersion() + '\n'
|
+ "[Multiverse-Core] version: " + this.plugin.getMVConfig().getVersion() + '\n'
|
||||||
|
@ -22,6 +22,8 @@ public class EntryFee extends SerializationConfig {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private Material currency;
|
private Material currency;
|
||||||
|
|
||||||
|
private final Material DISABLED_MATERIAL = Material.AIR;
|
||||||
|
|
||||||
public EntryFee() {
|
public EntryFee() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
@ -51,6 +53,9 @@ public class EntryFee extends SerializationConfig {
|
|||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public Material getCurrency() {
|
public Material getCurrency() {
|
||||||
|
if (currency == null || currency.equals(DISABLED_MATERIAL)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return currency;
|
return currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.enums;
|
||||||
|
|
||||||
|
public enum RespawnType {
|
||||||
|
BED,
|
||||||
|
ANCHOR,
|
||||||
|
OTHER
|
||||||
|
}
|
@ -15,7 +15,9 @@ import com.dumptruckman.minecraft.util.Logging;
|
|||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||||
|
import com.onarandombox.MultiverseCore.enums.RespawnType;
|
||||||
import com.onarandombox.MultiverseCore.event.MVRespawnEvent;
|
import com.onarandombox.MultiverseCore.event.MVRespawnEvent;
|
||||||
|
import com.onarandombox.MultiverseCore.utils.CompatibilityLayer;
|
||||||
import com.onarandombox.MultiverseCore.utils.PermissionTools;
|
import com.onarandombox.MultiverseCore.utils.PermissionTools;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -69,9 +71,16 @@ public class MVPlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RespawnType respawnType = RespawnType.OTHER;
|
||||||
|
if (event.isBedSpawn()) {
|
||||||
|
respawnType = RespawnType.BED;
|
||||||
|
}
|
||||||
|
if (CompatibilityLayer.isAnchorSpawn(event)) {
|
||||||
|
respawnType = RespawnType.ANCHOR;
|
||||||
|
}
|
||||||
|
|
||||||
if (mvWorld.getBedRespawn() && event.isBedSpawn()) {
|
if (mvWorld.getBedRespawn() && (respawnType == RespawnType.BED || respawnType == RespawnType.ANCHOR)) {
|
||||||
Logging.fine("Spawning " + event.getPlayer().getName() + " at their bed");
|
Logging.fine("Spawning %s at their %s", event.getPlayer().getName(), respawnType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.utils;
|
||||||
|
|
||||||
|
import com.dumptruckman.minecraft.util.Logging;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A utility class to enable version specific minecraft features.
|
||||||
|
*/
|
||||||
|
public class CompatibilityLayer {
|
||||||
|
|
||||||
|
private static Method checkAnchorSpawn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise the reflection methods.
|
||||||
|
*/
|
||||||
|
public static void init() {
|
||||||
|
try {
|
||||||
|
checkAnchorSpawn = PlayerRespawnEvent.class.getDeclaredMethod("isAnchorSpawn");
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
Logging.fine("%s does not support respawn anchors.", Bukkit.getVersion());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the respawn point is of respawn anchor type.
|
||||||
|
* Introduced in minecraft 1.16
|
||||||
|
*
|
||||||
|
* @param event A player respawn event.
|
||||||
|
* @return If the respawn location is an anchor point.
|
||||||
|
*/
|
||||||
|
public static boolean isAnchorSpawn(PlayerRespawnEvent event) {
|
||||||
|
if (checkAnchorSpawn == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return (boolean) checkAnchorSpawn.invoke(event);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logging.warning("Error checking for: %s", checkAnchorSpawn);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -46,6 +46,15 @@ public class SimpleLocationManipulation implements LocationManipulation {
|
|||||||
orientationInts.put("w", 90);
|
orientationInts.put("w", 90);
|
||||||
orientationInts.put("nw", 135);
|
orientationInts.put("nw", 135);
|
||||||
|
|
||||||
|
orientationInts.put("north", 180);
|
||||||
|
orientationInts.put("northeast", 225);
|
||||||
|
orientationInts.put("east", 270);
|
||||||
|
orientationInts.put("southeast", 315);
|
||||||
|
orientationInts.put("south", 0);
|
||||||
|
orientationInts.put("southwest", 45);
|
||||||
|
orientationInts.put("west", 90);
|
||||||
|
orientationInts.put("northwest", 135);
|
||||||
|
|
||||||
// "freeze" the map:
|
// "freeze" the map:
|
||||||
ORIENTATION_INTS = Collections.unmodifiableMap(orientationInts);
|
ORIENTATION_INTS = Collections.unmodifiableMap(orientationInts);
|
||||||
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
||||||
|
@ -50,6 +50,10 @@ public class TestEntryFeeConversion {
|
|||||||
WorldProperties props = new WorldProperties(config);
|
WorldProperties props = new WorldProperties(config);
|
||||||
assertNull(props.entryfee.getCurrency());
|
assertNull(props.entryfee.getCurrency());
|
||||||
|
|
||||||
|
entryFee.put("currency", 0);
|
||||||
|
props = new WorldProperties(config);
|
||||||
|
assertNull(props.entryfee.getCurrency());
|
||||||
|
|
||||||
entryFee.put("currency", 1);
|
entryFee.put("currency", 1);
|
||||||
props = new WorldProperties(config);
|
props = new WorldProperties(config);
|
||||||
assertEquals(Material.STONE, props.entryfee.getCurrency());
|
assertEquals(Material.STONE, props.entryfee.getCurrency());
|
||||||
|
@ -225,11 +225,18 @@ public class TestInstanceCreator {
|
|||||||
serverfield.set(core, mockServer);
|
serverfield.set(core, mockServer);
|
||||||
|
|
||||||
// Set buscript
|
// Set buscript
|
||||||
Buscript buscript = PowerMockito.spy(new Buscript(core));
|
Buscript buscript;
|
||||||
Field buscriptfield = MultiverseCore.class.getDeclaredField("buscript");
|
Field buscriptfield = MultiverseCore.class.getDeclaredField("buscript");
|
||||||
buscriptfield.setAccessible(true);
|
buscriptfield.setAccessible(true);
|
||||||
buscriptfield.set(core, buscript);
|
|
||||||
|
try {
|
||||||
|
buscript = PowerMockito.spy(new Buscript(core));
|
||||||
when(buscript.getPlugin()).thenReturn(core);
|
when(buscript.getPlugin()).thenReturn(core);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
buscript = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
buscriptfield.set(core, buscript);
|
||||||
|
|
||||||
// Set worldManager
|
// Set worldManager
|
||||||
WorldManager wm = PowerMockito.spy(new WorldManager(core));
|
WorldManager wm = PowerMockito.spy(new WorldManager(core));
|
||||||
|
Loading…
Reference in New Issue
Block a user