Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/BentoBoxWorld/bentobox.git
Browse files Browse the repository at this point in the history
… into develop
  • Loading branch information
tastybento committed Aug 31, 2018
2 parents 4eadd25 + cacea15 commit 4203ce8
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 45 deletions.
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/world/bentobox/bentobox/BentoBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ public void onEnable(){
// Start head getter
headGetter = new HeadGetter(this);

// Load metrics
BStats bStats = new BStats(this);

// Load Notifier
notifier = new Notifier();

Expand Down Expand Up @@ -132,8 +129,11 @@ public void onEnable(){
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());
Expand Down
20 changes: 0 additions & 20 deletions src/main/java/world/bentobox/bentobox/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -176,13 +170,6 @@ public boolean isMetrics() {
return metrics;
}

/**
* @return the checkUpdates
*/
public boolean isCheckUpdates() {
return checkUpdates;
}

/**
* @return the defaultLanguage
*/
Expand Down Expand Up @@ -310,13 +297,6 @@ public void setMetrics(boolean metrics) {
this.metrics = metrics;
}

/**
* @param checkUpdates the checkUpdates to set
*/
public void setCheckUpdates(boolean checkUpdates) {
this.checkUpdates = checkUpdates;
}

/**
* @param defaultLanguage the defaultLanguage to set
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
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;
Expand All @@ -18,11 +19,16 @@
*/
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
Expand All @@ -42,10 +48,10 @@ public boolean execute(User user, String label, List<String> args) {
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:
Expand All @@ -55,10 +61,10 @@ public boolean execute(User user, String label, List<String> args) {
} 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:
Expand All @@ -80,15 +86,15 @@ private void showZones(User user) {

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));
}
Expand All @@ -99,25 +105,34 @@ private void hideZones(User user) {
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);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,11 @@ public boolean showInfo(BentoBox plugin, User user, World world) {
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));
Expand Down

0 comments on commit 4203ce8

Please sign in to comment.