Permalink
Browse files

Add new Version event code

  • Loading branch information...
1 parent 3c6ab0a commit 40c9d8a27e8be3869b7b5fa5bcf5e4bd0aa721ee @FernFerret FernFerret committed Jan 1, 2012
@@ -24,7 +24,11 @@
import java.io.File;
import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -309,4 +313,14 @@ private String logAndAddToPasteBinBuffer(String string) {
this.log(Level.INFO, string);
return "[Multiverse-NetherPortals] " + string + "\n";
}
+
+ public String getVersionInfo() {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("[Multiverse-NetherPortals] Multiverse-NetherPortals Version: ").append(this.getDescription().getVersion()).append('\n');
+ buffer.append("[Multiverse-NetherPortals] World links: ").append(this.getWorldLinks()).append('\n');
+ buffer.append("[Multiverse-NetherPortals] Nether Prefix: ").append(netherPrefix).append('\n');
+ buffer.append("[Multiverse-NetherPortals] Nether Suffix: ").append(netherSuffix).append('\n');
+ buffer.append("[Multiverse-NetherPortals] Special Code: ").append("FRN001").append('\n');
+ return buffer.toString();
+ }
}
@@ -1,6 +1,7 @@
package com.onarandombox.MultiverseNetherPortals.listeners;
import com.onarandombox.MultiverseCore.event.MVConfigReloadEvent;
+import com.onarandombox.MultiverseCore.event.MVVersionEvent;
import com.onarandombox.MultiverseCore.event.MVVersionRequestEvent;
import com.onarandombox.MultiverseNetherPortals.MultiverseNetherPortals;
import org.bukkit.event.CustomEventListener;
@@ -15,11 +16,8 @@ public MVNPConfigReloadListener(MultiverseNetherPortals plugin) {
@Override
public void onCustomEvent(Event event) {
- if (event.getEventName().equals("MVConfigReload") && event instanceof MVConfigReloadEvent) {
- plugin.loadConfig();
- ((MVConfigReloadEvent) event).addConfig("Multiverse-NetherPortals - config.yml");
- } else if (event.getEventName().equals("MVVersion") && event instanceof MVVersionRequestEvent) {
- ((MVVersionRequestEvent) event).setPasteBinBuffer(this.plugin.dumpVersionInfo(((MVVersionRequestEvent) event).getPasteBinBuffer()));
+ if (event.getEventName().equals("MVVersionEvent") && event instanceof MVVersionEvent) {
+ ((MVVersionEvent) event).appendVersionInfo(this.plugin.getVersionInfo());
}
}
}
@@ -5,6 +5,7 @@
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.event.MVPlayerTouchedPortalEvent;
import com.onarandombox.MultiverseCore.utils.LocationManipulation;
+import com.onarandombox.MultiverseCore.utils.MVMessaging;
import com.onarandombox.MultiverseCore.utils.PermissionTools;
import com.onarandombox.MultiverseNetherPortals.MultiverseNetherPortals;
import com.onarandombox.MultiverseNetherPortals.enums.PortalType;
@@ -32,6 +33,7 @@
private MVWorldManager worldManager;
private PermissionTools pt;
private int cooldown = 250;
+ private MVMessaging messaging;
private Map<String, Date> playerErrors;
private Map<String, Location> eventRecord;
// This hash map will track players most recent portal touch.
@@ -46,6 +48,8 @@ public MVNPEntityListener(MultiverseNetherPortals plugin) {
this.pt = new PermissionTools(this.plugin.getCore());
this.playerErrors = new HashMap<String, Date>();
this.eventRecord = new HashMap<String, Location>();
+ this.messaging = this.plugin.getCore().getMessaging();
+
}
protected void shootPlayer(Player p, Block block, PortalType type) {
@@ -132,7 +136,7 @@ public void onEntityPortalEnter(EntityPortalEnterEvent event) {
if (toLocation == null) {
this.shootPlayer(p, eventLocation.getBlock(), type);
- p.sendMessage("This portal goes nowhere!");
+ this.messaging.sendMessage(p, "This portal goes nowhere!", false);
return;
}
MultiverseWorld fromWorld = this.worldManager.getMVWorld(p.getLocation().getWorld().getName());

0 comments on commit 40c9d8a

Please sign in to comment.