modified hideme a little :)

This commit is contained in:
Cheese 2015-11-02 14:37:12 +11:00
parent da6bf27c77
commit cdb0fcae75
2 changed files with 78 additions and 29 deletions

View File

@ -11,6 +11,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.Rank;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
@ -65,7 +66,7 @@ public class HubVisibilityManager extends MiniPlugin
{ {
boolean hideMe = Manager.GetTutorial().InTutorial(player) || boolean hideMe = Manager.GetTutorial().InTutorial(player) ||
UtilMath.offset2d(player.getLocation(), Manager.GetSpawn()) == 0 || UtilMath.offset2d(player.getLocation(), Manager.GetSpawn()) == 0 ||
// Manager.getPreferences().Get(player).Invisibility || Manager.getPreferences().Get(player).Invisibility ||
_hiddenPlayers.contains(player); _hiddenPlayers.contains(player);
for (Player other : UtilServer.getPlayers()) for (Player other : UtilServer.getPlayers())
@ -73,11 +74,9 @@ public class HubVisibilityManager extends MiniPlugin
if (player.equals(other)) if (player.equals(other))
continue; continue;
if(Manager.getPreferences().Get(player).Invisibility && if(Manager.GetClients().Get(other).GetRank().has(Rank.MODERATOR))
!Manager.GetClients().Get(other).GetRank().has(Manager.GetClients().Get(player).GetRank())) hideMe = false;
{
hideMe = true;
}
if (hideMe || if (hideMe ||
!Manager.getPreferences().Get(other).ShowPlayers || !Manager.getPreferences().Get(other).ShowPlayers ||
Manager.GetTutorial().InTutorial(other)) Manager.GetTutorial().InTutorial(other))

View File

@ -901,34 +901,84 @@ public class MapParser extends JavaPlugin implements Listener
event.getPlayer().setVelocity(vel); event.getPlayer().setVelocity(vel);
} }
@EventHandler @EventHandler(priority = EventPriority.LOWEST)
public void signChangeLog(SignChangeEvent event) public void signChangeLog(SignChangeEvent event)
{ {
if (GetData(event.getPlayer().getWorld().getName()).HasAccess(event.getPlayer())) if (GetData(event.getPlayer().getWorld().getName()).HasAccess(event.getPlayer()))
{ {
try ArrayList<String> text = new ArrayList<String>();
{
File file = new File(event.getPlayer().getWorld().getName() + "/" + "sign_log.txt");
if (!file.exists()) text.add("Date: " + UtilTime.now());
file.createNewFile(); text.add("Player: " + event.getPlayer().getName());
text.add("Location: " + UtilWorld.locToStrClean(event.getBlock().getLocation()));
for (int i=0 ; i<event.getLines().length ; i++)
text.add("Line " + i + ": " + event.getLines()[i]);
FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); writeSignLog(text, event.getPlayer().getWorld());
BufferedWriter bw = new BufferedWriter(fw); }
}
bw.write("\n\n"); @EventHandler(priority = EventPriority.LOWEST)
bw.write("\n" + "Date: " + UtilTime.now()); public void signCommand(PlayerCommandPreprocessEvent event)
bw.write("\n" + "Player: " + event.getPlayer().getName()); {
bw.write("\n" + "Location: " + UtilWorld.locToStrClean(event.getBlock().getLocation())); if (event.getMessage().toLowerCase().contains("set"))
for (int i=0 ; i<event.getLines().length ; i++) {
bw.write("\n" + "Line " + i + ": " + event.getLines()[i]); ArrayList<String> text = new ArrayList<String>();
bw.close(); text.add("Date: " + UtilTime.now());
} text.add("Player: " + event.getPlayer().getName());
catch (Exception e) text.add("Location: " + UtilWorld.locToStrClean(event.getPlayer().getLocation()));
{ text.add("Message: " + event.getMessage());
e.printStackTrace();
} writeSignCommandLog(text, event.getPlayer().getWorld());
}
}
public void writeSignCommandLog(ArrayList<String> text, World world)
{
try
{
File file = new File(world.getName() + "/" + "command_sign_log.txt");
if (!file.exists())
file.createNewFile();
FileWriter fw = new FileWriter(file.getAbsoluteFile(), true);
BufferedWriter bw = new BufferedWriter(fw);
bw.write("\n\n");
for (String line : text)
bw.write("\n" + line);
bw.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void writeSignLog(ArrayList<String> text, World world)
{
try
{
File file = new File(world.getName() + "/" + "sign_log.txt");
if (!file.exists())
file.createNewFile();
FileWriter fw = new FileWriter(file.getAbsoluteFile(), true);
BufferedWriter bw = new BufferedWriter(fw);
bw.write("\n\n");
for (String line : text)
bw.write("\n" + line);
bw.close();
}
catch (Exception e)
{
e.printStackTrace();
} }
} }
} }