Skip to content

Commit

Permalink
v2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Moresteck committed Dec 10, 2018
1 parent 296fe4e commit 01bbad6
Show file tree
Hide file tree
Showing 41 changed files with 91 additions and 87 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MultiWorld
Multi-world plugin for Bukkit with compatibility from **b1.2_01** to **1.1-R3** (**__confirmed__** compatibility)

## Stable version: 2.0.1
## Stable version: 2.0.2

## Recommended version: 2.0.1
## Recommended version: 2.0.2
6 changes: 5 additions & 1 deletion bin/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ v2.0-Pre3:
- Added '/mw unload ...' command
- Added '/mw list' command
- Added '/mw info ...' command
- Added world's history (can be disabled)

v2.0:
- Changed some chat messages
Expand All @@ -32,4 +33,7 @@ v2.0.1:
- Added permissions for commands: import, list, save, unload, who
- Added '/mw reload' command
- Added '/mw <command> help' command
- Fixed create and import command not responding when the world loads
- Fixed create and import command not responding when the world loads

v2.0.2:
- Fixed '/mw tp ...' for b1.2_01
Binary file modified bin/pl/moresteck/bvnpe/BukkitVersion.class
Binary file not shown.
Binary file modified bin/pl/moresteck/bvnpe/VersionParser.class
Binary file not shown.
Binary file modified bin/pl/moresteck/multiworld/MultiWorld.class
Binary file not shown.
Binary file modified bin/pl/moresteck/multiworld/Perm.class
Binary file not shown.
Binary file modified bin/pl/moresteck/multiworld/commands/MCommand.class
Binary file not shown.
Binary file modified bin/pl/moresteck/multiworld/commands/MCreate.class
Binary file not shown.
Binary file modified bin/pl/moresteck/multiworld/commands/MImport.class
Binary file not shown.
Binary file modified bin/pl/moresteck/multiworld/commands/MInfo.class
Binary file not shown.
Binary file modified bin/pl/moresteck/multiworld/commands/MList.class
Binary file not shown.
Binary file modified bin/pl/moresteck/multiworld/commands/MPluginInfo.class
Binary file not shown.
Binary file modified bin/pl/moresteck/multiworld/commands/MReload.class
Binary file not shown.
Binary file modified bin/pl/moresteck/multiworld/commands/MSave.class
Binary file not shown.
Binary file modified bin/pl/moresteck/multiworld/commands/MSetSpawn.class
Binary file not shown.
Binary file modified bin/pl/moresteck/multiworld/commands/MTeleport.class
Binary file not shown.
Binary file modified bin/pl/moresteck/multiworld/commands/MUnload.class
Binary file not shown.
Binary file modified bin/pl/moresteck/multiworld/commands/MWho.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified bin/pl/moresteck/multiworld/world/MWorld.class
Binary file not shown.
Binary file modified lib/bukkit.jar
Binary file not shown.
6 changes: 5 additions & 1 deletion src/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ v2.0-Pre3:
- Added '/mw unload ...' command
- Added '/mw list' command
- Added '/mw info ...' command
- Added world's history (can be disabled)

v2.0:
- Changed some chat messages
Expand All @@ -32,4 +33,7 @@ v2.0.1:
- Added permissions for commands: import, list, save, unload, who
- Added '/mw reload' command
- Added '/mw <command> help' command
- Fixed create and import command not responding when the world loads
- Fixed create and import command not responding when the world loads

v2.0.2:
- Fixed '/mw tp ...' for b1.2_01
22 changes: 14 additions & 8 deletions src/pl/moresteck/bvnpe/BukkitVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public static String getBukkitVersion() {
return MultiWorld.server.getVersion();
}

/**
* Says if the Bukkit version is higher than 1.1-R4.
*
* @return Version higher than 1.1-R4
*/
public static boolean isVersionHigh() {
return getVersionId() > 19 ? true :
getBukkitVersion().startsWith("git-Bukkit-1.1-R4") ||
Expand All @@ -33,22 +38,23 @@ public static boolean isVersionHigh() {
}

/**
* Returns the version number.
* Detects versions from b1.1 to 1.1.
* Gets the version number. <br />
* Detects versions from b1.1 to 1.1. <br />
* ID 20 is higher than 1.1.
*
* @return Version id starting from 0
*/
public static int getVersionId() {
if (version.equals("b1.1")) {
// It may be 1.1, 1.1_02 or 1.2.
// It may be b1.1, b1.1_02 or b1.2.
return 0;
} else if (version.equals("b1.2_01")) {
// b1.2_02 vanilla server never existed.
return 1;
} else if (version.equals("b1.3")) {
return 2;
} else if (version.equals("b1.4")) {
// No Bukkit for b1.4_01.
// Cannot recognize b1.4_01 Bukkit.
return 3;
} else if (version.equals("b1.5_02")) {
// No Bukkit for b1.5 and b1.5_01.
Expand Down Expand Up @@ -92,7 +98,7 @@ public static int getVersionId() {

/**
* Registers an event, but may result in an NPE.
*
* <br />
* You don't have to specify the priority and type if your version is 1.1-R4 or higher.
*
* @param type Type enum to register (e.g. "PLAYER_ITEM", "PLAYER_INTERACT")
Expand All @@ -110,8 +116,8 @@ public static void registerEvent(JavaPlugin plugin, String type,

/**
* You still have to do self-check for the Bukkit's version for no warnings.
*
* Safely registers an event with specified Priority.
* <br />
* Safely registers an event with specified Priority. <br />
* You don't have to specify the priority and type if your version is 1.1-R4 or higher.
*
* @param type Type enum to register (e.g. "PLAYER_ITEM", "PLAYER_INTERACT")
Expand All @@ -129,7 +135,7 @@ public static void registerEventSafely(JavaPlugin plugin, String type,

/**
* You still have to do self-check for the Bukkit's version for no warnings.
*
* <br />
* Safely registers an event.
*
* @param type Type enum to register (e.g. "PLAYER_ITEM", "PLAYER_INTERACT")
Expand Down
13 changes: 13 additions & 0 deletions src/pl/moresteck/bvnpe/VersionParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ public static String parseVersion(Server server) {
return parseVersion(server.getVersion());
}

/**
* Gives the version number from b1.1 to 1.1.
* <br />
* For higher versions use {@link BukkitVersion.getVersionId()}
* or {@link BukkitVersion.isVersionHigh()}
*
* @param bver Version from Bukkit.getVersion()
* @return Formatted version
*/
public static String parseVersion(String bver) {
if (bver.equals("1.1") || bver.equals("1.2_01")) {
// "1.1" may indicate b1.1, b1.1_02 or even b1.2!
Expand All @@ -28,4 +37,8 @@ public static String parseVersion(String bver) {
return "b" + version;
}
}

public static int getVersionId() {
return BukkitVersion.getVersionId();
}
}
6 changes: 4 additions & 2 deletions src/pl/moresteck/multiworld/Perm.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public static void setPermissions(Plugin p) {
}

/** Permissions:
* <pre>multiworld.*:
* <pre>
* multiworld.*:
* multiworld.world.*:
* multiworld.world.save
* multiworld.world.create
Expand All @@ -34,7 +35,8 @@ public static void setPermissions(Plugin p) {
* multiworld.info.list
* multiworld.info.who
* multiworld.player.*:
* multiworld.player.teleport</pre>
* multiworld.player.teleport
* </pre>
*/
public static boolean has(CommandSender cs, String perm) {
if (!(cs instanceof Player)) {
Expand Down
14 changes: 14 additions & 0 deletions src/pl/moresteck/multiworld/commands/MCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import pl.moresteck.multiworld.Perm;

public abstract class MCommand {
private Command cmd;
private CommandSender cs;
Expand Down Expand Up @@ -51,6 +53,18 @@ public boolean isPlayer() {
return (this.getSender() instanceof Player);
}

public boolean hasPermission() {
return Perm.has(cs, perm);
}

public String getPermission() {
return this.perm;
}

public void setPermission(String perm) {
this.perm = perm;
}

public abstract void execute();

public abstract void displayCommandHelp();
Expand Down
7 changes: 3 additions & 4 deletions src/pl/moresteck/multiworld/commands/MCreate.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@

import pl.moresteck.bvnpe.BukkitVersion;
import pl.moresteck.multiworld.MultiWorld;
import pl.moresteck.multiworld.Perm;
import pl.moresteck.multiworld.world.MWorld;
import pl.moresteck.multiworld.world.MWorldConfig;

public class MCreate extends MCommand {

public MCreate(Command cmd, CommandSender cs, String[] args) {
super(cmd, cs, args);
this.perm = "multiworld.world.create";
this.setPermission("multiworld.world.create");
}

public void execute() {
Expand All @@ -32,7 +31,7 @@ public void execute() {
this.displayCommandHelp();
return;
}
if (!Perm.has(this.getSender(), this.perm)) {
if (!this.hasPermission()) {
this.send("No permission!");
return;
}
Expand Down Expand Up @@ -155,7 +154,7 @@ public void displayCommandHelp() {
this.send(ChatColor.DARK_GRAY + " environment" + ChatColor.WHITE + " - Environment: " + ChatColor.GREEN + "normal " + ChatColor.RED + "nether");
}
this.send(" ");
this.send(ChatColor.DARK_AQUA + "Permission: " + (Perm.has(this.getSender(), this.perm) ? ChatColor.GREEN : ChatColor.RED) + this.perm);
this.send(ChatColor.DARK_AQUA + "Permission: " + (this.hasPermission() ? ChatColor.GREEN : ChatColor.RED) + this.perm);
this.send(ChatColor.DARK_AQUA + "Info: " + ChatColor.WHITE + "Creates new world using given arguments");
}
}
7 changes: 3 additions & 4 deletions src/pl/moresteck/multiworld/commands/MImport.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@

import pl.moresteck.bvnpe.BukkitVersion;
import pl.moresteck.multiworld.MultiWorld;
import pl.moresteck.multiworld.Perm;
import pl.moresteck.multiworld.world.MWorld;
import pl.moresteck.multiworld.world.MWorldConfig;

public class MImport extends MCommand {

public MImport(Command cmd, CommandSender cs, String[] args) {
super(cmd, cs, args);
this.perm = "multiworld.world.import";
this.setPermission("multiworld.world.import");
}

public void execute() {
Expand All @@ -38,7 +37,7 @@ public void execute() {
return;
}
}
if (!Perm.has(this.getSender(), this.perm)) {
if (!this.hasPermission()) {
this.send("No permission!");
return;
}
Expand Down Expand Up @@ -134,7 +133,7 @@ public void displayCommandHelp() {
this.send(ChatColor.DARK_GRAY + " environment" + ChatColor.WHITE + " - Environment: " + ChatColor.GREEN + "normal " + ChatColor.RED + "nether");
}
this.send(" ");
this.send(ChatColor.DARK_AQUA + "Permission: " + (Perm.has(this.getSender(), this.perm) ? ChatColor.GREEN : ChatColor.RED) + this.perm);
this.send(ChatColor.DARK_AQUA + "Permission: " + (this.hasPermission() ? ChatColor.GREEN : ChatColor.RED) + this.perm);
this.send(ChatColor.DARK_AQUA + "Info: " + ChatColor.WHITE + "Imports a world using given arguments");
}
}
7 changes: 3 additions & 4 deletions src/pl/moresteck/multiworld/commands/MInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@

import pl.moresteck.bvnpe.BukkitVersion;
import pl.moresteck.multiworld.MultiWorld;
import pl.moresteck.multiworld.Perm;
import pl.moresteck.multiworld.world.MWorld;

public class MInfo extends MCommand {

public MInfo(Command cmd, CommandSender cs, String[] args) {
super(cmd, cs, args);
this.perm = "multiworld.world.info";
this.setPermission("multiworld.world.info");
}

public void execute() {
Expand All @@ -28,7 +27,7 @@ public void execute() {
return;
}
}
if (!Perm.has(this.getSender(), this.perm)) {
if (!this.hasPermission()) {
this.send("No permission!");
return;
}
Expand Down Expand Up @@ -91,7 +90,7 @@ public void displayCommandHelp() {
this.send(ChatColor.DARK_GRAY + " world_name" + ChatColor.WHITE + " - Which world's info to view");
this.send(ChatColor.DARK_GRAY + " page" + ChatColor.WHITE + " - Info page");
this.send(" ");
this.send(ChatColor.DARK_AQUA + "Permission: " + (Perm.has(this.getSender(), this.perm) ? ChatColor.GREEN : ChatColor.RED) + this.perm);
this.send(ChatColor.DARK_AQUA + "Permission: " + (this.hasPermission() ? ChatColor.GREEN : ChatColor.RED) + this.perm);
this.send(ChatColor.DARK_AQUA + "Info: " + ChatColor.WHITE + "Shows some information about specified world");
}
}
7 changes: 3 additions & 4 deletions src/pl/moresteck/multiworld/commands/MList.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
import org.bukkit.command.CommandSender;

import pl.moresteck.multiworld.MultiWorld;
import pl.moresteck.multiworld.Perm;
import pl.moresteck.multiworld.world.MWorld;

public class MList extends MCommand {

public MList(Command cmd, CommandSender cs, String[] args) {
super(cmd, cs, args);
this.perm = "multiworld.info.list";
this.setPermission("multiworld.info.list");
}

public void execute() {
Expand All @@ -27,7 +26,7 @@ public void execute() {
return;
}
}
if (!Perm.has(this.getSender(), this.perm)) {
if (!this.hasPermission()) {
this.send("No permission!");
return;
}
Expand All @@ -50,7 +49,7 @@ public void displayCommandHelp() {
this.send(ChatColor.GREEN + "====== Command Help ======");
this.send(ChatColor.BLUE + "/mw list");
this.send(" ");
this.send(ChatColor.DARK_AQUA + "Permission: " + (Perm.has(this.getSender(), this.perm) ? ChatColor.GREEN : ChatColor.RED) + this.perm);
this.send(ChatColor.DARK_AQUA + "Permission: " + (this.hasPermission() ? ChatColor.GREEN : ChatColor.RED) + this.perm);
this.send(ChatColor.DARK_AQUA + "Info: " + ChatColor.WHITE + "Views the world list");
}
}
5 changes: 4 additions & 1 deletion src/pl/moresteck/multiworld/commands/MPluginInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

import pl.moresteck.multiworld.MultiWorld;

public class MPluginInfo extends MCommand {

public MPluginInfo(Command cmd, CommandSender cs, String[] args) {
super(cmd, cs, args);
this.perm = "none";
this.setPermission("none");
}

public void execute() {
Expand All @@ -26,6 +28,7 @@ public void execute() {
this.send("This plugin was made possible by " + ChatColor.GREEN + "BetaCraft server");
this.send("Author: " + ChatColor.GREEN + "Moresteck");
this.send("General help: " + ChatColor.AQUA + "Kazu (KazuGod)");
this.send("Version: " + ChatColor.GREEN + MultiWorld.version);
this.send("Website: " + ChatColor.GRAY + "https://" + ChatColor.YELLOW + "betacraft" + ChatColor.GRAY + "." + ChatColor.YELLOW + "ovh" + ChatColor.GRAY + "/");
this.send(" Thanks for using this plugin! I hope you find it handy :)");
}
Expand Down
7 changes: 3 additions & 4 deletions src/pl/moresteck/multiworld/commands/MReload.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
import org.bukkit.command.CommandSender;

import pl.moresteck.multiworld.MultiWorld;
import pl.moresteck.multiworld.Perm;
import pl.moresteck.multiworld.world.MWorld;
import pl.moresteck.multiworld.world.MWorldConfig;

public class MReload extends MCommand {

public MReload(Command cmd, CommandSender cs, String[] args) {
super(cmd, cs, args);
this.perm = "multiworld.world.reloadconfig";
this.setPermission("multiworld.world.reloadconfig");
}

public void execute() {
Expand All @@ -30,7 +29,7 @@ public void execute() {
return;
}
}
if (!Perm.has(this.getSender(), this.perm)) {
if (!this.hasPermission()) {
this.send("No permission!");
return;
}
Expand Down Expand Up @@ -100,7 +99,7 @@ public void displayCommandHelp() {
this.send(ChatColor.GREEN + "====== Command Help ======");
this.send(ChatColor.BLUE + "/mw reload");
this.send(" ");
this.send(ChatColor.DARK_AQUA + "Permission: " + (Perm.has(this.getSender(), this.perm) ? ChatColor.GREEN : ChatColor.RED) + this.perm);
this.send(ChatColor.DARK_AQUA + "Permission: " + (this.hasPermission() ? ChatColor.GREEN : ChatColor.RED) + this.perm);
this.send(ChatColor.DARK_AQUA + "Info: " + ChatColor.WHITE + "Reloads worlds from configuration");
}
}
Loading

0 comments on commit 01bbad6

Please sign in to comment.