Skip to content
This repository has been archived by the owner on Jul 7, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/BentoBoxWorld/BentoBox in…
Browse files Browse the repository at this point in the history
…to 1.13.2

� Conflicts:
�	pom.xml
�	src/test/java/world/bentobox/bentobox/listeners/flags/settings/PVPListenerTest.java
  • Loading branch information
BONNe committed Feb 15, 2020
2 parents 2771296 + 273893c commit 65ac024
Show file tree
Hide file tree
Showing 41 changed files with 3,179 additions and 1,289 deletions.
36 changes: 18 additions & 18 deletions ADDON.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
The following is a list of all addons currently made for BentoBox:
* [**Bank**](https://github.com/BentoBoxWorld/Bank): Allow your players to deposit and withdraw money from the island's bank!
* [**Biomes**](https://github.com/BentoBoxWorld/Biomes): Enables players to change biomes on islands.
* [**Border**](https://github.com/BentoBoxWorld/Border): Adds a world border around islands.
* [**Cauldron Witchery**](https://github.com/BentoBoxWorld/CauldronWitchery): Allows summoning mobs using some magic!
* [**Challenges**](https://github.com/BentoBoxWorld/Challenges): Gives your players challenges to accomplish.
* [**Chat**](https://github.com/BentoBoxWorld/Chat): TeamChat and IslandChat for BentoBox gamemodes.
* [**Control Panel**](https://github.com/BentoBoxWorld/ControlPanel): This is simple ControlPanel for all BentoBox GameMode addons.
* [**Dimensional Trees**](https://github.com/BentoBoxWorld/DimensionalTrees): Turns the trees that grow in the Nether or in the End into specific materials.
* [**Greenhouses**](https://github.com/BentoBoxWorld/Greenhouses): Enables players to make mini biome glass houses on their island.
* [**IslandFly**](https://github.com/BentoBoxWorld/IslandFly): Allows your players to fly on their islands.
* [**InvSwitcher**](https://github.com/BentoBoxWorld/addon-invSwitcher): Allows you to split inventories between the different gamemode worlds.
* [**Level**](https://github.com/BentoBoxWorld/Level): Calculate your island level and show a top ten. Also so you can brag to your friends :D
* [**Likes**](https://github.com/BentoBoxWorld/Likes): Creates a voting system to rank islands.
* [**Limits**](https://github.com/BentoBoxWorld/Limits): Limits blocks and entities that your players can place on their islands.
* [**MagicCobblestoneGenerator**](https://github.com/BentoBoxWorld/MagicCobblestoneGenerator): Generates any blocks in a cobblestone generator.
* [**TwerkingForTrees**](https://github.com/BentoBoxWorld/TwerkingForTrees): Twerk to make trees grow faster on your island.
* [**VoidPortals**](https://github.com/BentoBoxWorld/VoidPortals): Teleports to the dimensions by falling into the Void:
* [**Warps**](https://github.com/BentoBoxWorld/Warps): Enables players to plant a warp sign and visit other player's islands.
* [**Biomes**](https://github.com/BentoBoxWorld/Biomes/): Enables players to change biomes on islands.
* [**Border**](https://github.com/BentoBoxWorld/Border/): Adds a world border around islands.
* [**Cauldron Witchery**](https://github.com/BentoBoxWorld/CauldronWitchery/): Allows summoning mobs using some magic!
* [**Challenges**](https://github.com/BentoBoxWorld/Challenges/): Gives your players challenges to accomplish.
* [**Chat**](https://github.com/BentoBoxWorld/Chat/): TeamChat and IslandChat for BentoBox gamemodes.
* [**Control Panel**](https://github.com/BentoBoxWorld/ControlPanel/): This is simple ControlPanel for all BentoBox GameMode addons.
* [**Dimensional Trees**](https://github.com/BentoBoxWorld/DimensionalTrees/): Turns the trees that grow in the Nether or in the End into specific materials.
* [**ExtraMobs**](https://github.com/BentoBoxWorld/ExtraMobs/): Adjusts some mob spawning rules to get Blazes, Wither Skeleton, Shulkers and Bees.
* [**Greenhouses**](https://github.com/BentoBoxWorld/Greenhouses/): Enables players to make mini biome glass houses on their island.
* [**IslandFly**](https://github.com/BentoBoxWorld/IslandFly/): Allows your players to fly on their islands.
* [**InvSwitcher**](https://github.com/BentoBoxWorld/InvSwitcher/): Allows you to split inventories between the different worlds.
* [**Level**](https://github.com/BentoBoxWorld/Level/): Calculate your island level and show a top ten. Also so you can brag to your friends :D
* [**Likes**](https://github.com/BentoBoxWorld/Likes/): Creates a voting system to rank islands.
* [**Limits**](https://github.com/BentoBoxWorld/Limits/): Limits blocks and entities that your players can place on their islands.
* [**MagicCobblestoneGenerator**](https://github.com/BentoBoxWorld/MagicCobblestoneGenerator/): Generates any blocks in a cobblestone generator.
* [**TwerkingForTrees**](https://github.com/BentoBoxWorld/TwerkingForTrees/): Twerk to make trees grow faster on your island.
* [**VoidPortals**](https://github.com/BentoBoxWorld/VoidPortals/): Teleports to the dimensions by falling into the Void:
* [**Warps**](https://github.com/BentoBoxWorld/Warps/): Enables players to plant a warp sign and visit other player's islands.

With more to come :D
32 changes: 16 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@
<!-- Non-minecraft related dependencies -->
<powermock.version>2.0.4</powermock.version>
<mongodb.version>3.8.0</mongodb.version>
<!-- More visible way how to change dependency versions -->
<!-- More visible way to change dependency versions -->
<spigot.version>1.13.2-R0.1-SNAPSHOT</spigot.version>
<bstats.version>1.5</bstats.version>
<vault.version>1.7</vault.version>
<placeholderapi.version>2.10.3</placeholderapi.version>
<placeholderapi.version>2.10.4</placeholderapi.version>
<mvdwplaceholderapi.version>master-SNAPSHOT</mvdwplaceholderapi.version>
<githubapi.version>d5f5e0bbd8</githubapi.version>
<dynmap.version>3.0-SNAPSHOT</dynmap.version>
Expand All @@ -81,14 +81,14 @@
<!-- Do not change unless you want different name for local builds. -->
<build.number>-1.13.2-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>1.11.0</build.version>
<build.version>1.11.1</build.version>
</properties>

<!-- Profiles will allow to automatically change build version. -->
<profiles>
<profile>
<!-- ci profile is activated if exist environment variable BUILD_NUMBER. -->
<!-- It replaces ${build.number} that is currently '-LOCAL' with
<!-- It replaces ${build.number} that is currently '-LOCAL' with
correct build number from JENKINS machine. -->
<id>ci</id>
<activation>
Expand All @@ -102,13 +102,13 @@
</properties>
</profile>
<profile>
<!-- Master profile is activated if exist environment variable
<!-- Master profile is activated if exist environment variable
GIT_BRANCH and its value is origin/master. -->
<!-- It will replace 'revision' with '${build.version}' so it
<!-- It will replace 'revision' with '${build.version}' so it
removes '-SNAPSHOT' string at the end. -->
<!-- Also, as this is release build, build number can be set
<!-- Also, as this is release build, build number can be set
to empty string. -->
<!-- This profile will be used only if exist environment variable
<!-- This profile will be used only if exist environment variable
GIT_BRANCH with value origin/master. -->
<id>master</id>
<activation>
Expand Down Expand Up @@ -242,8 +242,8 @@
<scope>provided</scope>
</dependency>
<dependency>
<!-- We have to use a forked version of this api because Maxim
had the brilliant idea to make one of the dependencies rely on an illegal
<!-- We have to use a forked version of this api because Maxim
had the brilliant idea to make one of the dependencies rely on an illegal
artifact thus making its repository unusable. -->
<groupId>com.github.BentoBoxWorld</groupId>
<artifactId>MVdWPlaceholderAPI</artifactId>
Expand All @@ -270,8 +270,8 @@
<version>${githubapi.version}</version>
</dependency>
<!-- Static analysis -->
<!-- We are using Eclipse's annotations. If you're using IDEA, update
your project settings to take these into account for in real time static
<!-- We are using Eclipse's annotations. If you're using IDEA, update
your project settings to take these into account for in real time static
analysis -->
<dependency>
<groupId>org.eclipse.jdt</groupId>
Expand All @@ -289,12 +289,12 @@

<build>
<!-- By default ${revision} is ${build.version}-SNAPSHOT -->
<!-- If GIT_BRANCH variable is set to origin/master, then it will
<!-- If GIT_BRANCH variable is set to origin/master, then it will
be only ${build.version}. -->

<!-- By default ${build.number} is -LOCAL. -->
<!-- If the BUILD_NUMBER variable is set, then it will be -b[number]. -->
<!-- If GIT_BRANCH variable is set to origin/master, then it will
<!-- If GIT_BRANCH variable is set to origin/master, then it will
be the empty string. -->
<finalName>${project.name}-${revision}${build.number}</finalName>

Expand Down Expand Up @@ -398,7 +398,7 @@
</relocations>
<artifactSet>
<excludes>
<exclude>com.google:*</exclude>
<exclude>com.google.code.gson:*</exclude>
<exclude>org.mongodb:*</exclude>
<exclude>org.eclipse.jdt:*</exclude>
</excludes>
Expand Down Expand Up @@ -439,7 +439,7 @@
<configuration>
<append>true</append>
<excludes>
<!-- This is required to prevent Jacoco from adding
<!-- This is required to prevent Jacoco from adding
synthetic fields to a JavaBean class (causes errors in testing) -->
<exclude>**/*Names*</exclude>
</excludes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public DelayedTeleportCommand(CompositeCommand parent, String label, String... a
* @param confirmed Runnable to be executed if successfully delayed.
*/
public void delayCommand(User user, String message, Runnable confirmed) {
if (getSettings().getDelayTime() < 1 || user.isOp() || user.hasPermission(getPermissionPrefix() + "mod.bypasscooldowns")) {
if (getSettings().getDelayTime() < 1 || user.isOp() || user.hasPermission(getPermissionPrefix() + "mod.bypasscooldowns")
|| user.hasPermission(getPermissionPrefix() + "mod.bypassdelays")) {
Bukkit.getScheduler().runTask(getPlugin(), confirmed);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
import java.util.UUID;

import org.bukkit.Location;

import org.bukkit.entity.Player;
import org.eclipse.jdt.annotation.Nullable;

import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
Expand All @@ -16,6 +17,9 @@

public class AdminTeleportCommand extends CompositeCommand {

private @Nullable UUID targetUUID;
private @Nullable User userToTeleport;

/**
* @param parent - parent command
* @param tpCommand - should be "tp", "tpnether" or "tpend"
Expand All @@ -28,64 +32,75 @@ public AdminTeleportCommand(CompositeCommand parent, String tpCommand) {
public void setup() {
// Permission
setPermission("admin.tp");
setOnlyPlayer(true);
setParametersHelp("commands.admin.tp.parameters");
setDescription("commands.admin.tp.description");
}

@Override
public boolean execute(User user, String label, List<String> args) {
public boolean canExecute(User user, String label, List<String> args) {
if (args.size() != 1 && args.size() != 2) {
this.showHelp(this, user);
return false;
}

// Check for console or not
if (!user.isPlayer() && args.size() != 2) {
user.sendMessage("general.errors.use-in-game");
return false;
}
// Convert name to a UUID
final UUID targetUUID = getPlayers().getUUID(args.get(0));
targetUUID = getPlayers().getUUID(args.get(0));
if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
return false;
} else {
if (getIslands().hasIsland(getWorld(), targetUUID) || getIslands().inTeam(getWorld(), targetUUID)) {
Location warpSpot = getIslands().getIslandLocation(getWorld(), targetUUID).toVector().toLocation(getWorld());
if (getLabel().equals("tpnether")) {
warpSpot = getIslands().getIslandLocation(getWorld(), targetUUID).toVector().toLocation(getPlugin().getIWM().getNetherWorld(getWorld()));
} else if (getLabel().equals("tpend")) {
warpSpot = getIslands().getIslandLocation(getWorld(), targetUUID).toVector().toLocation(getPlugin().getIWM().getEndWorld(getWorld()));
}
// Otherwise, ask the admin to go to a safe spot
String failureMessage = user.getTranslation("commands.admin.tp.manual", "[location]", warpSpot.getBlockX() + " " + warpSpot.getBlockY() + " "
+ warpSpot.getBlockZ());
}
// Check island exists
if (!getIslands().hasIsland(getWorld(), targetUUID) && !getIslands().inTeam(getWorld(), targetUUID)) {
user.sendMessage("general.errors.player-has-no-island");
return false;
}

Player player = user.getPlayer();
if (args.size() == 2) {
// We are trying to teleport another player
UUID playerToTeleportUUID = getPlayers().getUUID(args.get(1));
if (playerToTeleportUUID == null) {
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(1));
return false;
} else {
User userToTeleport = User.getInstance(playerToTeleportUUID);
if (!userToTeleport.isOnline()) {
user.sendMessage("general.errors.offline-player");
return false;
}
player = userToTeleport.getPlayer();
failureMessage = userToTeleport.getTranslation("general.errors.no-safe-location-found");
}
if (args.size() == 2) {
// We are trying to teleport another player
UUID playerToTeleportUUID = getPlayers().getUUID(args.get(1));
if (playerToTeleportUUID == null) {
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(1));
return false;
} else {
userToTeleport = User.getInstance(playerToTeleportUUID);
if (!userToTeleport.isOnline()) {
user.sendMessage("general.errors.offline-player");
return false;
}

// Teleport
new SafeSpotTeleport.Builder(getPlugin())
.entity(player)
.location(warpSpot)
.failureMessage(failureMessage)
.build();
return true;
}
user.sendMessage("general.errors.player-has-no-island");
return false;
}
return true;
}

@Override
public boolean execute(User user, String label, List<String> args) {
Location warpSpot = getIslands().getIslandLocation(getWorld(), targetUUID).toVector().toLocation(getWorld());
if (getLabel().equals("tpnether")) {
warpSpot = getIslands().getIslandLocation(getWorld(), targetUUID).toVector().toLocation(getPlugin().getIWM().getNetherWorld(getWorld()));
} else if (getLabel().equals("tpend")) {
warpSpot = getIslands().getIslandLocation(getWorld(), targetUUID).toVector().toLocation(getPlugin().getIWM().getEndWorld(getWorld()));
}
// Otherwise, ask the admin to go to a safe spot
String failureMessage = user.getTranslation("commands.admin.tp.manual", "[location]", warpSpot.getBlockX() + " " + warpSpot.getBlockY() + " "
+ warpSpot.getBlockZ());

Player player = user.getPlayer();
if (args.size() == 2) {
player = userToTeleport.getPlayer();
failureMessage = userToTeleport.getTranslation("general.errors.no-safe-location-found");
}

// Teleport
new SafeSpotTeleport.Builder(getPlugin())
.entity(player)
.location(warpSpot)
.failureMessage(failureMessage)
.build();
return true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public boolean execute(User user, String label, List<String> args) {
}
// Set the debug meta
target.getPlayer().setMetadata(getWorld().getName() + "_why_debug", new FixedMetadataValue(getPlugin(), newValue));
if (user.isPlayer()) {
target.getPlayer().setMetadata(getWorld().getName() + "_why_debug_issuer", new FixedMetadataValue(getPlugin(), user.getUniqueId().toString()));
}
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public boolean execute(User user, String label, List<String> args) {
// Resets the island name
getIslands().getIsland(getWorld(), playerUUID).setName(null);

user.sendMessage("general.success");
user.sendMessage("commands.island.resetname.success");
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public boolean execute(User user, String label, List<String> args) {
String name = String.join(" ", args);

// Check if the name isn't too short or too long
if (name.length() < getSettings().getNameMinLength()) {
user.sendMessage("commands.island.setname.name-too-short", TextVariables.NUMBER, String.valueOf(getSettings().getNameMinLength()));
if (name.length() < getSettings().getNameMinLength() || ChatColor.stripColor(name).isEmpty()) {
user.sendMessage("commands.island.setname.name-too-short", TextVariables.NUMBER, String.valueOf(getSettings().getNameMinLength()));
return false;
}
if (name.length() > getSettings().getNameMaxLength()) {
Expand All @@ -72,7 +72,7 @@ public boolean execute(User user, String label, List<String> args) {

// Everything's good!
getIslands().getIsland(getWorld(), playerUUID).setName(name);
user.sendMessage("general.success");
user.sendMessage("commands.island.setname.success", TextVariables.NAME, name);
return true;
}
}
Loading

0 comments on commit 65ac024

Please sign in to comment.