Fix for character overflow

This commit is contained in:
lishd 2011-09-18 19:34:06 -04:00
parent 8791143e66
commit b0aeef46d8
3 changed files with 25 additions and 3 deletions

View file

@ -16,6 +16,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import com.nijiko.permissions.PermissionHandler; import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions; import com.nijikokun.bukkit.Permissions.Permissions;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.util.config.Configuration;
/** /**
* Open other player's inventory * Open other player's inventory
@ -27,6 +28,7 @@ public class OpenInv extends JavaPlugin {
private final OpenInvEntityListener entityListener = new OpenInvEntityListener(this); private final OpenInvEntityListener entityListener = new OpenInvEntityListener(this);
//private final OpenInvInventoryListener inventoryListener = new OpenInvInventoryListener(this); //private final OpenInvInventoryListener inventoryListener = new OpenInvInventoryListener(this);
public static PermissionHandler permissionHandler; public static PermissionHandler permissionHandler;
public static Configuration config;
public void onDisable() { public void onDisable() {
} }
@ -43,6 +45,7 @@ public class OpenInv extends JavaPlugin {
} }
public void onEnable() { public void onEnable() {
config = this.getConfiguration();
PluginManager pm = getServer().getPluginManager(); PluginManager pm = getServer().getPluginManager();
pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Event.Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Event.Priority.Normal, this);
@ -78,4 +81,24 @@ public class OpenInv extends JavaPlugin {
System.out.println("[OpenInv] Error while trying to override player inventory, error: " + e.getMessage()); System.out.println("[OpenInv] Error while trying to override player inventory, error: " + e.getMessage());
} }
} }
public static Object GetFromConfig(String data, Object defaultValue)
{
Object val = config.getProperty(data);
if (val == null)
{
config.setProperty(data, defaultValue);
return defaultValue;
}
else
{
return val;
}
}
public static void SaveToConfig(String data, Object value)
{
config.setProperty(data, value);
config.save();
}
} }

View file

@ -2,7 +2,6 @@ package lishid.openinv.utils;
import net.minecraft.server.ContainerPlayer; import net.minecraft.server.ContainerPlayer;
import net.minecraft.server.EntityHuman; import net.minecraft.server.EntityHuman;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.InventoryPlayer; import net.minecraft.server.InventoryPlayer;
public class PlayerInventoryChest extends InventoryPlayer public class PlayerInventoryChest extends InventoryPlayer
@ -20,7 +19,7 @@ public class PlayerInventoryChest extends InventoryPlayer
@Override @Override
public String getName() { public String getName() {
return ((EntityPlayer)this.d).displayName; return "Player Inventory";
} }
@Override @Override

View file

@ -1,6 +1,6 @@
name: OpenInv name: OpenInv
main: lishid.openinv.OpenInv main: lishid.openinv.OpenInv
version: 1.4.1 version: 1.4.2
author: lishid author: lishid
description: > description: >
This plugin allows you to open another player's inventory as a chest This plugin allows you to open another player's inventory as a chest