Merge branch 'develop' of https://github.com/BentoBoxWorld/bentobox.git into develop

This commit is contained in:
tastybento 2018-08-31 10:49:56 +09:00
commit 4203ce85b4
5 changed files with 56 additions and 45 deletions

View File

@ -9,7 +9,7 @@ BentoBox
![Bugs](https://sonarcloud.io/api/project_badges/measure?project=world.bentobox%3Abentobox%3Adevelop&metric=bugs)
BentoBox is an expandable Minecraft Bukkit plugin for island-type games like ASkyBlock or AcidIsland.
BentoBox is an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland.
Admins can assemble the game or games how they like with a variety of add-ons. These include:
* BSkyBlock - the successor to the popular ASkyBlock. Don't fall!
@ -20,18 +20,31 @@ Admins can assemble the game or games how they like with a variety of add-ons. T
Bentobox represents a turning point on ASkyBlock's history : Tastybento and Poslovitch thought up and designed this complete rewrite in order to provide a whole new way to play Skyblock and other island-style games.
**Discover BSkyBlock today, its gameplay overhaul, and enjoy the Skyblock revival!**
Disclaimer
==========
BentoBox and all subsequent addons made by the BentoBoxWorld team are being developped **as a hobby** without receiving any kind of remuneration. You will **never** have to pay to download BentoBox or any addon created by the BentoBoxWorld team or to get access to the source code.
Hereby, **you** and **only you** are wrong when you :
* insist that we should fix a bug within an irrational period of time;
* behave rudely;
* are asking for support whereas solutions have already been given or are easily accessible;
Bugs and Feature requests
=========================
File bug and feature requests here: https://github.com/BentoBoxWorld/bentobox/issues
File bug and feature requests here: https://github.com/BentoBoxWorld/bentobox/issues. Make sure that your issue is following the guidelines, otherwise it will be declined.
Note for developers
===================
We consider Pull Requests from non-collaborators that contain actual code improvements or bug fixes. Do not submit PRs that only address code formatting because they will not be accepted.
Official Builds
===============
https://github.com/BentoBoxWorld/bentobox/releases
Development Builds
==================
**These development builds are not eligible to any kind of support. Use them at your own discretion or only under our approval.**
Jenkins: https://ci.codemc.org/job/BentoBoxWorld/job/bentobox/
API

View File

@ -85,9 +85,6 @@ public class BentoBox extends JavaPlugin {
// Start head getter
headGetter = new HeadGetter(this);
// Load metrics
BStats bStats = new BStats(this);
// Load Notifier
notifier = new Notifier();
@ -132,8 +129,11 @@ public class BentoBox extends JavaPlugin {
instance.log("- Tastybento and Poslovitch, 2017-2018");
instance.log("#############################################");
// Register metrics
bStats.registerMetrics();
// Load metrics
if (settings.isMetrics()) {
BStats bStats = new BStats(this);
bStats.registerMetrics();
}
// Fire plugin ready event
Bukkit.getServer().getPluginManager().callEvent(new BentoBoxReadyEvent());

View File

@ -33,12 +33,6 @@ public class Settings implements DataObject {
@ConfigEntry(path = "general.metrics")
private boolean metrics = true;
@ConfigComment("Check for updates - this will tell Ops and the console if there is a new")
@ConfigComment("version available. It contacts dev.bukkit.org to request the latest version")
@ConfigComment("info. It does not download the latest version or change any files")
@ConfigEntry(path = "general.check-updates")
private boolean checkUpdates = true;
@ConfigComment("Default language for new players.")
@ConfigComment("This is the filename in the locale folder without .yml.")
@ConfigComment("If this does not exist, the default en-US will be used.")
@ -176,13 +170,6 @@ public class Settings implements DataObject {
return metrics;
}
/**
* @return the checkUpdates
*/
public boolean isCheckUpdates() {
return checkUpdates;
}
/**
* @return the defaultLanguage
*/
@ -310,13 +297,6 @@ public class Settings implements DataObject {
this.metrics = metrics;
}
/**
* @param checkUpdates the checkUpdates to set
*/
public void setCheckUpdates(boolean checkUpdates) {
this.checkUpdates = checkUpdates;
}
/**
* @param defaultLanguage the defaultLanguage to set
*/

View File

@ -5,6 +5,7 @@ import java.util.List;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
@ -18,11 +19,16 @@ import world.bentobox.bentobox.api.user.User;
*/
public class AdminRangeDisplayCommand extends CompositeCommand {
// Command aliases
private static final String DISPLAY = "display";
private static final String SHOW = "show";
private static final String HIDE = "hide";
// Map of users to which ranges must be displayed
private Map<User, Integer> display = new HashMap<>();
public AdminRangeDisplayCommand(CompositeCommand parent) {
super(parent, DISPLAY, "show", "hide");
super(parent, DISPLAY, SHOW, HIDE);
}
@Override
@ -42,10 +48,10 @@ public class AdminRangeDisplayCommand extends CompositeCommand {
if (!display.containsKey(user)) {
switch (label) {
case DISPLAY:
case "show":
case SHOW:
showZones(user);
break;
case "hide":
case HIDE:
user.sendMessage("commands.admin.range.display.already-off");
break;
default:
@ -55,10 +61,10 @@ public class AdminRangeDisplayCommand extends CompositeCommand {
} else {
switch (label) {
case DISPLAY:
case "hide":
case HIDE:
hideZones(user);
break;
case "show":
case SHOW:
user.sendMessage("commands.admin.range.display.already-on");
break;
default:
@ -80,15 +86,15 @@ public class AdminRangeDisplayCommand extends CompositeCommand {
getIslands().getIslandAt(user.getLocation()).ifPresent(island -> {
// Draw the island protected area
drawZone(user.getPlayer(), Particle.BARRIER, island.getCenter(), island.getProtectionRange());
drawZone(user.getPlayer(), Particle.BARRIER, null, island.getCenter(), island.getProtectionRange());
// Draw the default protected area if island protected zone is different
if (island.getProtectionRange() != getPlugin().getIWM().getIslandProtectionRange(getWorld())) {
drawZone(user.getPlayer(), Particle.VILLAGER_HAPPY, island.getCenter(), getPlugin().getIWM().getIslandProtectionRange(getWorld()));
drawZone(user.getPlayer(), Particle.VILLAGER_HAPPY, null, island.getCenter(), getPlugin().getIWM().getIslandProtectionRange(getWorld()));
}
// Draw the island area
drawZone(user.getPlayer(), Particle.TOWN_AURA, island.getCenter(), island.getRange());
drawZone(user.getPlayer(), Particle.REDSTONE, new Particle.DustOptions(Color.GRAY, 1.0F),island.getCenter(), island.getRange());
});
}, 20, 30));
}
@ -99,25 +105,34 @@ public class AdminRangeDisplayCommand extends CompositeCommand {
display.remove(user);
}
private void drawZone(Player player, Particle particle, Location center, int range) {
private void drawZone(Player player, Particle particle, Particle.DustOptions dustOptions, Location center, int range) {
if (particle.equals(Particle.REDSTONE) && dustOptions == null) {
// Security check that will avoid later unexpected exceptions.
throw new IllegalArgumentException("A non-null Particle.DustOptions must be provided when using Particle.REDSTONE.");
}
// Get player Y coordinate
int playerY = player.getLocation().getBlockY() + 1;
// Draw 3 "stages" (one line below, at and above player's y coordinate)
for (int stage = -1 ; stage <= 1 ; stage++) {
for (int i = -range ; i <= range ; i++) {
spawnParticle(player, particle, center.getBlockX() + i, playerY + stage, center.getBlockZ() + range);
spawnParticle(player, particle, center.getBlockX() + i, playerY + stage, center.getBlockZ() - range);
spawnParticle(player, particle, center.getBlockX() + range, playerY + stage, center.getBlockZ() + i);
spawnParticle(player, particle, center.getBlockX() - range, playerY + stage, center.getBlockZ() + i);
spawnParticle(player, particle, dustOptions, center.getBlockX() + i, playerY + stage, center.getBlockZ() + range);
spawnParticle(player, particle, dustOptions, center.getBlockX() + i, playerY + stage, center.getBlockZ() - range);
spawnParticle(player, particle, dustOptions, center.getBlockX() + range, playerY + stage, center.getBlockZ() + i);
spawnParticle(player, particle, dustOptions, center.getBlockX() - range, playerY + stage, center.getBlockZ() + i);
}
}
}
private void spawnParticle(Player player, Particle particle, int x, int y, int z) {
private void spawnParticle(Player player, Particle particle, Particle.DustOptions dustOptions, int x, int y, int z) {
// Check if this particle is beyond the viewing distance of the server
if (player.getLocation().toVector().distanceSquared(new Vector(x,y,z)) < (Bukkit.getServer().getViewDistance()*256*Bukkit.getServer().getViewDistance())) {
player.spawnParticle(particle, x, y, z, 1);
if (particle.equals(Particle.REDSTONE)) {
player.spawnParticle(particle, x, y, z, 1, 0, 0, 0, 1, dustOptions);
} else {
player.spawnParticle(particle, x, y, z, 1);
}
}
}
}

View File

@ -601,8 +601,11 @@ public class Island implements DataObject {
user.sendMessage("commands.admin.info.unowned");
} else {
user.sendMessage("commands.admin.info.owner", "[owner]", plugin.getPlayers().getName(owner), "[uuid]", owner.toString());
Date d = new Date(plugin.getServer().getOfflinePlayer(owner).getLastPlayed());
user.sendMessage("commands.admin.info.last-login","[date]", d.toString());
// Fixes #getLastPlayed() returning 0 when it is the owner's first connection.
long lastPlayed = (plugin.getServer().getOfflinePlayer(owner).getLastPlayed() != 0) ?
plugin.getServer().getOfflinePlayer(owner).getLastPlayed() : plugin.getServer().getOfflinePlayer(owner).getFirstPlayed();
user.sendMessage("commands.admin.info.last-login","[date]", new Date(lastPlayed).toString());
user.sendMessage("commands.admin.info.deaths", "[number]", String.valueOf(plugin.getPlayers().getDeaths(world, owner)));
String resets = String.valueOf(plugin.getPlayers().getResets(world, owner));