mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-26 20:47:01 +01:00
Add new version cmd, lots of cleanup
This commit is contained in:
parent
f09bcac644
commit
9eff255f47
@ -71,7 +71,7 @@ public class MVEntityListener extends EntityListener {
|
|||||||
Player pattacker = (Player) attacker;
|
Player pattacker = (Player) attacker;
|
||||||
|
|
||||||
|
|
||||||
if (!world.getPvp() && this.plugin.configMV.getBoolean("fakepvp", false)) {
|
if (!world.getPvp() && this.plugin.getConfig().getBoolean("fakepvp", false)) {
|
||||||
pattacker.sendMessage(ChatColor.RED + "PVP is disabled in this World.");
|
pattacker.sendMessage(ChatColor.RED + "PVP is disabled in this World.");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
@ -86,7 +86,7 @@ public class MVEntityListener extends EntityListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RegainReason reason = event.getRegainReason();
|
RegainReason reason = event.getRegainReason();
|
||||||
if (reason == RegainReason.REGEN && this.plugin.configMV.getBoolean("disableautoheal", false)) {
|
if (reason == RegainReason.REGEN && this.plugin.getConfig().getBoolean("disableautoheal", false)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.onarandombox.MultiverseCore;
|
package com.onarandombox.MultiverseCore;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
@ -75,7 +74,7 @@ public class MVPermissions implements PermissionsInterface {
|
|||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
boolean opFallback = this.plugin.configMV.getBoolean("opfallback", true);
|
boolean opFallback = this.plugin.getConfig().getBoolean("opfallback", true);
|
||||||
if (this.permissions != null && this.permissions.has(player, node)) {
|
if (this.permissions != null && this.permissions.has(player, node)) {
|
||||||
// If Permissions is enabled we check against them.
|
// If Permissions is enabled we check against them.
|
||||||
return true;
|
return true;
|
||||||
|
@ -3,12 +3,9 @@ package com.onarandombox.MultiverseCore;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.player.PlayerBedLeaveEvent;
|
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
import org.bukkit.event.player.PlayerListener;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
@ -38,7 +35,7 @@ public class MVPlayerListener extends PlayerListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Check whether the Server is set to prefix the chat with the World name. If not we do nothing, if so we need to check if the World has an Alias.
|
// Check whether the Server is set to prefix the chat with the World name. If not we do nothing, if so we need to check if the World has an Alias.
|
||||||
if (this.plugin.configMV.getBoolean("worldnameprefix", true)) {
|
if (this.plugin.getConfig().getBoolean("worldnameprefix", true)) {
|
||||||
String world = event.getPlayer().getWorld().getName();
|
String world = event.getPlayer().getWorld().getName();
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
// If we're not a MV world, don't do anything
|
// If we're not a MV world, don't do anything
|
||||||
|
@ -2,34 +2,28 @@ package com.onarandombox.MultiverseCore;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.config.Configuration;
|
import org.bukkit.util.config.Configuration;
|
||||||
|
|
||||||
import com.onarandombox.utils.BlockSafety;
|
|
||||||
|
|
||||||
public class MVPlayerSession {
|
public class MVPlayerSession {
|
||||||
|
|
||||||
private Player player; // Player holder, may be unnecessary.
|
private Player player; // Player holder, may be unnecessary.
|
||||||
private BlockSafety bs = new BlockSafety();
|
|
||||||
|
|
||||||
private Long teleportLast = 0L; // Timestamp for the Players last Portal Teleportation.
|
private Long teleportLast = 0L; // Timestamp for the Players last Portal Teleportation.
|
||||||
private Long messageLast = 0L; // Timestamp for the Players last Alert Message.
|
private Long messageLast = 0L; // Timestamp for the Players last Alert Message.
|
||||||
|
|
||||||
private Location bedSpawn;
|
// private Location bedSpawn;
|
||||||
|
//
|
||||||
// Beds are 2 blocks, thus we need to store both places
|
// // Beds are 2 blocks, thus we need to store both places
|
||||||
private Location bedA;
|
// private Location bedA;
|
||||||
private Location bedB;
|
// private Location bedB;
|
||||||
|
|
||||||
private Configuration config; // Configuration file to find out Cooldown Timers.
|
private Configuration config; // Configuration file to find out Cooldown Timers.
|
||||||
|
|
||||||
public MVPlayerSession(Player player, Configuration config, MultiverseCore multiVerseCore) {
|
public MVPlayerSession(Player player, Configuration config, MultiverseCore multiVerseCore) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.bedSpawn = null;
|
// this.bedSpawn = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,9 +60,12 @@ public class MVPlayerSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRespawnLocation(Location location) {
|
// Commented out bed code, i'll get rid of it soon.
|
||||||
this.bedSpawn = location;
|
// --FF
|
||||||
}
|
|
||||||
|
// public void setRespawnLocation(Location location) {
|
||||||
|
// this.bedSpawn = location;
|
||||||
|
// }
|
||||||
|
|
||||||
// // This one simply spawns the player closer to the bed.
|
// // This one simply spawns the player closer to the bed.
|
||||||
// public Location getBedRespawnLocation() {
|
// public Location getBedRespawnLocation() {
|
||||||
|
@ -450,7 +450,7 @@ public class MVWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setPvp(Boolean pvp) {
|
public void setPvp(Boolean pvp) {
|
||||||
this.fakepvp = this.plugin.configMV.getBoolean("fakepvp", false);
|
this.fakepvp = this.plugin.getConfig().getBoolean("fakepvp", false);
|
||||||
if (this.fakepvp) {
|
if (this.fakepvp) {
|
||||||
this.world.setPVP(true);
|
this.world.setPVP(true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -50,8 +50,8 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
public MVPermissions ph;
|
public MVPermissions ph;
|
||||||
|
|
||||||
// Configurations
|
// Configurations
|
||||||
public Configuration configMV = null;
|
private Configuration configMV = null;
|
||||||
public Configuration configWorlds = null;
|
private Configuration configWorlds = null;
|
||||||
|
|
||||||
// Setup the block/player/entity listener.
|
// Setup the block/player/entity listener.
|
||||||
private MVPlayerListener playerListener = new MVPlayerListener(this);;
|
private MVPlayerListener playerListener = new MVPlayerListener(this);;
|
||||||
@ -71,6 +71,7 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
public AllPay banker = new AllPay(this, "[Multiverse-Core] ");
|
public AllPay banker = new AllPay(this, "[Multiverse-Core] ");
|
||||||
public static boolean defaultConfigsCreated = false;
|
public static boolean defaultConfigsCreated = false;
|
||||||
protected MVConfigMigrator migrator = new MVConfigMigrator(this);
|
protected MVConfigMigrator migrator = new MVConfigMigrator(this);
|
||||||
|
protected int pluginCount;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
@ -81,6 +82,10 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Configuration getConfig() {
|
||||||
|
return this.configMV;
|
||||||
|
}
|
||||||
|
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
// Output a little snippet to show it's enabled.
|
// Output a little snippet to show it's enabled.
|
||||||
this.log(Level.INFO, "- Version " + this.getDescription().getVersion() + " Enabled - By " + getAuthors());
|
this.log(Level.INFO, "- Version " + this.getDescription().getVersion() + " Enabled - By " + getAuthors());
|
||||||
@ -173,6 +178,7 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
private void registerCommands() {
|
private void registerCommands() {
|
||||||
// Intro Commands
|
// Intro Commands
|
||||||
|
this.commandHandler.registerCommand(new VersionCommand(this));
|
||||||
this.commandHandler.registerCommand(new ListCommand(this));
|
this.commandHandler.registerCommand(new ListCommand(this));
|
||||||
this.commandHandler.registerCommand(new InfoCommand(this));
|
this.commandHandler.registerCommand(new InfoCommand(this));
|
||||||
this.commandHandler.registerCommand(new CreateCommand(this));
|
this.commandHandler.registerCommand(new CreateCommand(this));
|
||||||
@ -591,4 +597,27 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
this.playerSessions.remove(player.getName());
|
this.playerSessions.remove(player.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of plugins that have specifically hooked into core.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int getPluginCount() {
|
||||||
|
return this.pluginCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increments the number of plugins that have specifically hooked into core.
|
||||||
|
*/
|
||||||
|
public void incrementPluginCount() {
|
||||||
|
this.pluginCount += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrements the number of plugins that have specifically hooked into core.
|
||||||
|
*/
|
||||||
|
public void decrementPluginCount() {
|
||||||
|
this.pluginCount -= 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public class InfoCommand extends MultiverseCommand {
|
|||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ChatColor getChatColor(boolean positive) {
|
protected ChatColor getChatColor(boolean positive) {
|
||||||
return positive ? ChatColor.GREEN : ChatColor.RED;
|
return positive ? ChatColor.GREEN : ChatColor.RED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.permissions.PermissionDefault;
|
import org.bukkit.permissions.PermissionDefault;
|
||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MVPlayerSession;
|
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
|
||||||
public class SleepCommand extends MultiverseCommand {
|
public class SleepCommand extends MultiverseCommand {
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.permissions.PermissionDefault;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
|
||||||
|
public class VersionCommand extends MultiverseCommand {
|
||||||
|
|
||||||
|
public VersionCommand(MultiverseCore plugin) {
|
||||||
|
super(plugin);
|
||||||
|
this.setName("Multiverse Version");
|
||||||
|
this.setCommandUsage("/mv version");
|
||||||
|
this.setArgRange(0, 0);
|
||||||
|
this.addKey("mv version");
|
||||||
|
this.addKey("mvv");
|
||||||
|
this.addKey("mvversion");
|
||||||
|
this.setPermission("multiverse.core.version", "What version of Multiverse-Core are you on!.", PermissionDefault.TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCommand(CommandSender sender, List<String> args) {
|
||||||
|
// Check if the command was sent from a Player.
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
sender.sendMessage("Version info dumped to console. Please check your server logs.");
|
||||||
|
}
|
||||||
|
this.plugin.log(Level.INFO, "Multiverse-Core Version: " + this.plugin.getDescription().getVersion());
|
||||||
|
this.plugin.log(Level.INFO, "Loaded Worlds: " + this.plugin.getMVWorlds().size());
|
||||||
|
this.plugin.log(Level.INFO, "Multiverse Plugins Loaded: " + this.plugin.getPluginCount());
|
||||||
|
this.plugin.log(Level.INFO, "Dumping Config Values: (version " + this.plugin.getConfig().getString("version", "NOT SET") + ")");
|
||||||
|
this.plugin.log(Level.INFO, "messagecooldown: " + this.plugin.getConfig().getString("messagecooldown", "NOT SET"));
|
||||||
|
this.plugin.log(Level.INFO, "teleportcooldown: " + this.plugin.getConfig().getString("messagecooldown", "NOT SET"));
|
||||||
|
this.plugin.log(Level.INFO, "worldnameprefix: " + this.plugin.getConfig().getString("messagecooldown", "NOT SET"));
|
||||||
|
this.plugin.log(Level.INFO, "opfallback: " + this.plugin.getConfig().getString("messagecooldown", "NOT SET"));
|
||||||
|
this.plugin.log(Level.INFO, "disableautoheal: " + this.plugin.getConfig().getString("messagecooldown", "NOT SET"));
|
||||||
|
this.plugin.log(Level.INFO, "fakepvp: " + this.plugin.getConfig().getString("messagecooldown", "NOT SET"));
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,5 @@
|
|||||||
package com.onarandombox.utils;
|
package com.onarandombox.utils;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
|
||||||
public class Destination {
|
public class Destination {
|
||||||
|
@ -2,14 +2,12 @@ package com.onarandombox.utils;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
|
|
||||||
|
|
||||||
import com.earth2me.essentials.Mob.Enemies;
|
|
||||||
import com.onarandombox.MultiverseCore.MVWorld;
|
import com.onarandombox.MultiverseCore.MVWorld;
|
||||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
# !!!This only applies to worlds being handled by Multiverse!!!
|
# !!!This only applies to worlds being handled by Multiverse!!!
|
||||||
# If you don't see it using /mvlist this setting WILL HAVE NO EFFECT
|
# If you don't see it using /mvlist this setting WILL HAVE NO EFFECT
|
||||||
|
|
||||||
# How long to leave in between sending a message to the player.
|
# How long to leave in between sending a message to the player. (NOT YET IMPLEMENTED)
|
||||||
# In Milliseconds - Default is '5000' which is 5 Seconds.
|
# In Milliseconds - Default is '5000' which is 5 Seconds.
|
||||||
messagecooldown: 5000
|
messagecooldown: 5000
|
||||||
|
|
||||||
|
# How fast are people allowed to use /MVTP (NOT YET IMPLEMENTED)
|
||||||
|
# In Milliseconds - Default is '5000' which is 5 Seconds.
|
||||||
|
teleportcooldown: 5000
|
||||||
|
|
||||||
# If this is set to true, we will prefix the chat with
|
# If this is set to true, we will prefix the chat with
|
||||||
# a colorful world alias if it's present. If not, we simply
|
# a colorful world alias if it's present. If not, we simply
|
||||||
# show the world's name in white. If this is false Multiverse
|
# show the world's name in white. If this is false Multiverse
|
||||||
@ -26,10 +30,6 @@ disableautoheal: false
|
|||||||
# Players will be notified when they punch/shoot and it's not allowed.
|
# Players will be notified when they punch/shoot and it's not allowed.
|
||||||
fakepvp: false
|
fakepvp: false
|
||||||
|
|
||||||
# When this is enabled, users will spawn at their last bed slept at. If the bed is destroyed or obstructed,
|
|
||||||
# they will spawn according to how you have 'notchrespawnstyle' set.
|
|
||||||
bedrespawn: true
|
|
||||||
|
|
||||||
# This just signifies the version number so we can see what version of config you have.
|
# This just signifies the version number so we can see what version of config you have.
|
||||||
# NEVER TOUCH THIS VALUE
|
# NEVER TOUCH THIS VALUE
|
||||||
version: 2.0
|
version: 2.1
|
@ -155,3 +155,11 @@ commands:
|
|||||||
description: Tells the user all possible world types.
|
description: Tells the user all possible world types.
|
||||||
usage: |
|
usage: |
|
||||||
/<command>
|
/<command>
|
||||||
|
mvv:
|
||||||
|
description: Prints out version invo.
|
||||||
|
usage: |
|
||||||
|
/<command>
|
||||||
|
mvversion:
|
||||||
|
description: Prints out version invo.
|
||||||
|
usage: |
|
||||||
|
/<command>
|
Loading…
Reference in New Issue
Block a user