mirror of
https://github.com/TotalFreedomMC/OpenInv.git
synced 2024-12-23 00:15:08 +00:00
Fixed silent chest issues
This commit is contained in:
parent
7d56a04283
commit
bc709336e1
5 changed files with 20 additions and 27 deletions
14
.gitignore
vendored
14
.gitignore
vendored
|
@ -1,7 +1,9 @@
|
||||||
.classpath
|
/.settings
|
||||||
.project
|
/.gitignore
|
||||||
.idea
|
/.project
|
||||||
|
/.classpath
|
||||||
|
/.idea
|
||||||
|
/bin
|
||||||
|
/lib
|
||||||
|
/out
|
||||||
*.iml
|
*.iml
|
||||||
bin/
|
|
||||||
lib/
|
|
||||||
out/
|
|
|
@ -79,14 +79,12 @@ public class OpenInvPluginCommand implements CommandExecutor {
|
||||||
target = this.plugin.getServer().getPlayer(name);
|
target = this.plugin.getServer().getPlayer(name);
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
if (target == null) {
|
// Try loading the player's data
|
||||||
// Try loading the player's data
|
target = OpenInv.playerLoader.loadPlayer(name);
|
||||||
target = OpenInv.playerLoader.loadPlayer(name);
|
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Player " + name + " not found!");
|
sender.sendMessage(ChatColor.RED + "Player " + name + " not found!");
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
|
|
||||||
package com.lishid.openinv.internal.v1_8_R1;
|
package com.lishid.openinv.internal.v1_8_R1;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -41,12 +39,6 @@ public class PlayerDataManager implements IPlayerDataManager {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default player folder
|
|
||||||
File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata");
|
|
||||||
if (!playerfolder.exists()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
|
OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -57,7 +49,7 @@ public class PlayerDataManager implements IPlayerDataManager {
|
||||||
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0)));
|
||||||
|
|
||||||
// Get the bukkit entity
|
// Get the bukkit entity
|
||||||
Player target = (entity == null) ? null : entity.getBukkitEntity();
|
Player target = entity.getBukkitEntity();
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
// Load data
|
// Load data
|
||||||
target.loadData();
|
target.loadData();
|
||||||
|
@ -81,7 +73,7 @@ public class PlayerDataManager implements IPlayerDataManager {
|
||||||
OfflinePlayer[] offlinePlayers = Bukkit.getOfflinePlayers();
|
OfflinePlayer[] offlinePlayers = Bukkit.getOfflinePlayers();
|
||||||
for (OfflinePlayer player : offlinePlayers) {
|
for (OfflinePlayer player : offlinePlayers) {
|
||||||
String name = player.getName();
|
String name = player.getName();
|
||||||
|
|
||||||
if (name == null){
|
if (name == null){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,12 +71,12 @@ public class SilentInventory implements ITileInventory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startOpen(EntityHuman entityHuman) {
|
public void startOpen(EntityHuman entityHuman) {
|
||||||
inv.startOpen(entityHuman);
|
//Don't do anything
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeContainer(EntityHuman entityHuman) {
|
public void closeContainer(EntityHuman entityHuman) {
|
||||||
inv.closeContainer(entityHuman);
|
//Don't do anything
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -151,7 +151,8 @@ public class SilentInventory implements ITileInventory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Container createContainer(PlayerInventory playerInventory, EntityHuman entityHuman) {
|
public Container createContainer(PlayerInventory playerInventory, EntityHuman entityHuman) {
|
||||||
return inv.createContainer(playerInventory, entityHuman);
|
//Don't let the chest itself create the container.
|
||||||
|
return new ContainerChest(playerInventory, this, entityHuman);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: OpenInv
|
name: OpenInv
|
||||||
main: com.lishid.openinv.OpenInv
|
main: com.lishid.openinv.OpenInv
|
||||||
version: 2.2.7
|
version: 2.2.8
|
||||||
author: lishid
|
author: lishid
|
||||||
description: >
|
description: >
|
||||||
This plugin allows you to open a player's inventory as a chest and interact with it in real time.
|
This plugin allows you to open a player's inventory as a chest and interact with it in real time.
|
||||||
|
|
Loading…
Reference in a new issue