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>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
@ -272,13 +272,19 @@
|
||||
<plugin>
|
||||
<groupId>se.eris</groupId>
|
||||
<artifactId>notnull-instrumenter-maven-plugin</artifactId>
|
||||
<version>0.6.8</version>
|
||||
<version>1.0.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>instrument</goal>
|
||||
<goal>tests-instrument</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<notNull>
|
||||
<param>org.jetbrains.annotations.NotNull</param>
|
||||
<param>javax.validation.constraints.NotNull</param>
|
||||
</notNull>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
@ -39,6 +39,7 @@ import com.onarandombox.MultiverseCore.listeners.MVWeatherListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVWorldInitListener;
|
||||
import com.onarandombox.MultiverseCore.listeners.MVWorldListener;
|
||||
import com.onarandombox.MultiverseCore.utils.AnchorManager;
|
||||
import com.onarandombox.MultiverseCore.utils.CompatibilityLayer;
|
||||
import com.onarandombox.MultiverseCore.utils.MVEconomist;
|
||||
import com.onarandombox.MultiverseCore.utils.MVMessaging;
|
||||
import com.onarandombox.MultiverseCore.utils.MVPermissions;
|
||||
@ -216,6 +217,8 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
// Setup our SafeTTeleporter
|
||||
this.safeTTeleporter = new SimpleSafeTTeleporter(this);
|
||||
this.unsafeCallWrapper = new UnsafeCallWrapper(this);
|
||||
// Setup our CompatibilityLayer
|
||||
CompatibilityLayer.init();
|
||||
}
|
||||
|
||||
|
||||
@ -313,13 +316,16 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
* Initializes the buscript javascript library.
|
||||
*/
|
||||
private void initializeBuscript() {
|
||||
try {
|
||||
buscript = new Buscript(this);
|
||||
// Add global variable "multiverse" to javascript environment
|
||||
buscript.setScriptVariable("multiverse", this);
|
||||
} catch (NullPointerException e) {
|
||||
buscript = null;
|
||||
Logging.warning("Buscript failed to load! The script command will be disabled!");
|
||||
buscript = null;
|
||||
|
||||
if (this.getMVConfig().getEnableBuscript()) {
|
||||
try {
|
||||
buscript = new Buscript(this);
|
||||
// Add global variable "multiverse" to javascript environment
|
||||
buscript.setScriptVariable("multiverse", this);
|
||||
} catch (NullPointerException e) {
|
||||
Logging.warning("Buscript failed to load! The script command will be disabled!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,8 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
@Property
|
||||
private volatile boolean displaypermerrors;
|
||||
@Property
|
||||
private volatile boolean enablebuscript;
|
||||
@Property
|
||||
private volatile int globaldebug;
|
||||
@Property
|
||||
private volatile boolean silentstart;
|
||||
@ -99,6 +101,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
teleportintercept = true;
|
||||
firstspawnoverride = true;
|
||||
displaypermerrors = true;
|
||||
enablebuscript = true;
|
||||
globaldebug = 0;
|
||||
messagecooldown = 5000;
|
||||
teleportcooldown = 1000;
|
||||
@ -213,6 +216,22 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
return this.displaypermerrors;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean getEnableBuscript() {
|
||||
return this.enablebuscript;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setEnableBuscript(boolean enableBuscript) {
|
||||
this.enablebuscript = enableBuscript;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -86,6 +86,18 @@ public interface MultiverseCoreConfig extends ConfigurationSerializable {
|
||||
*/
|
||||
boolean getDisplayPermErrors();
|
||||
|
||||
/**
|
||||
* Sets enableBuscript.
|
||||
* @param enableBuscript The new value.
|
||||
*/
|
||||
void setEnableBuscript(boolean enableBuscript);
|
||||
|
||||
/**
|
||||
* Gets enableBuscript.
|
||||
* @return enableBuscript.
|
||||
*/
|
||||
boolean getEnableBuscript();
|
||||
|
||||
/**
|
||||
* Sets firstSpawnOverride.
|
||||
* @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.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
|
||||
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.URLShortenerFactory;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.URLShortenerType;
|
||||
import net.milkbowl.vault.chat.Chat;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -163,6 +159,7 @@ public class VersionCommand extends MultiverseCommand {
|
||||
+ "[Multiverse-Core] firstspawnoverride: " + this.plugin.getMVConfig().getFirstSpawnOverride() + '\n'
|
||||
+ "[Multiverse-Core] displaypermerrors: " + this.plugin.getMVConfig().getDisplayPermErrors() + '\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] messagecooldown: " + this.plugin.getMessaging().getCooldown() + '\n'
|
||||
+ "[Multiverse-Core] version: " + this.plugin.getMVConfig().getVersion() + '\n'
|
||||
|
@ -22,6 +22,8 @@ public class EntryFee extends SerializationConfig {
|
||||
@Nullable
|
||||
private Material currency;
|
||||
|
||||
private final Material DISABLED_MATERIAL = Material.AIR;
|
||||
|
||||
public EntryFee() {
|
||||
super();
|
||||
}
|
||||
@ -51,6 +53,9 @@ public class EntryFee extends SerializationConfig {
|
||||
*/
|
||||
@Nullable
|
||||
public Material getCurrency() {
|
||||
if (currency == null || currency.equals(DISABLED_MATERIAL)) {
|
||||
return null;
|
||||
}
|
||||
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.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import com.onarandombox.MultiverseCore.enums.RespawnType;
|
||||
import com.onarandombox.MultiverseCore.event.MVRespawnEvent;
|
||||
import com.onarandombox.MultiverseCore.utils.CompatibilityLayer;
|
||||
import com.onarandombox.MultiverseCore.utils.PermissionTools;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -69,9 +71,16 @@ public class MVPlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
RespawnType respawnType = RespawnType.OTHER;
|
||||
if (event.isBedSpawn()) {
|
||||
respawnType = RespawnType.BED;
|
||||
}
|
||||
if (CompatibilityLayer.isAnchorSpawn(event)) {
|
||||
respawnType = RespawnType.ANCHOR;
|
||||
}
|
||||
|
||||
if (mvWorld.getBedRespawn() && event.isBedSpawn()) {
|
||||
Logging.fine("Spawning " + event.getPlayer().getName() + " at their bed");
|
||||
if (mvWorld.getBedRespawn() && (respawnType == RespawnType.BED || respawnType == RespawnType.ANCHOR)) {
|
||||
Logging.fine("Spawning %s at their %s", event.getPlayer().getName(), respawnType);
|
||||
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("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:
|
||||
ORIENTATION_INTS = Collections.unmodifiableMap(orientationInts);
|
||||
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
||||
|
@ -50,6 +50,10 @@ public class TestEntryFeeConversion {
|
||||
WorldProperties props = new WorldProperties(config);
|
||||
assertNull(props.entryfee.getCurrency());
|
||||
|
||||
entryFee.put("currency", 0);
|
||||
props = new WorldProperties(config);
|
||||
assertNull(props.entryfee.getCurrency());
|
||||
|
||||
entryFee.put("currency", 1);
|
||||
props = new WorldProperties(config);
|
||||
assertEquals(Material.STONE, props.entryfee.getCurrency());
|
||||
|
@ -225,11 +225,18 @@ public class TestInstanceCreator {
|
||||
serverfield.set(core, mockServer);
|
||||
|
||||
// Set buscript
|
||||
Buscript buscript = PowerMockito.spy(new Buscript(core));
|
||||
Buscript buscript;
|
||||
Field buscriptfield = MultiverseCore.class.getDeclaredField("buscript");
|
||||
buscriptfield.setAccessible(true);
|
||||
|
||||
try {
|
||||
buscript = PowerMockito.spy(new Buscript(core));
|
||||
when(buscript.getPlugin()).thenReturn(core);
|
||||
} catch (NullPointerException e) {
|
||||
buscript = null;
|
||||
}
|
||||
|
||||
buscriptfield.set(core, buscript);
|
||||
when(buscript.getPlugin()).thenReturn(core);
|
||||
|
||||
// Set worldManager
|
||||
WorldManager wm = PowerMockito.spy(new WorldManager(core));
|
||||
|
Loading…
Reference in New Issue
Block a user