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

View File

@ -901,14 +901,44 @@ public class MapParser extends JavaPlugin implements Listener
event.getPlayer().setVelocity(vel);
}
@EventHandler
@EventHandler(priority = EventPriority.LOWEST)
public void signChangeLog(SignChangeEvent event)
{
if (GetData(event.getPlayer().getWorld().getName()).HasAccess(event.getPlayer()))
{
ArrayList<String> text = new ArrayList<String>();
text.add("Date: " + UtilTime.now());
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]);
writeSignLog(text, event.getPlayer().getWorld());
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void signCommand(PlayerCommandPreprocessEvent event)
{
if (event.getMessage().toLowerCase().contains("set"))
{
ArrayList<String> text = new ArrayList<String>();
text.add("Date: " + UtilTime.now());
text.add("Player: " + event.getPlayer().getName());
text.add("Location: " + UtilWorld.locToStrClean(event.getPlayer().getLocation()));
text.add("Message: " + event.getMessage());
writeSignCommandLog(text, event.getPlayer().getWorld());
}
}
public void writeSignCommandLog(ArrayList<String> text, World world)
{
try
{
File file = new File(event.getPlayer().getWorld().getName() + "/" + "sign_log.txt");
File file = new File(world.getName() + "/" + "command_sign_log.txt");
if (!file.exists())
file.createNewFile();
@ -917,11 +947,32 @@ public class MapParser extends JavaPlugin implements Listener
BufferedWriter bw = new BufferedWriter(fw);
bw.write("\n\n");
bw.write("\n" + "Date: " + UtilTime.now());
bw.write("\n" + "Player: " + event.getPlayer().getName());
bw.write("\n" + "Location: " + UtilWorld.locToStrClean(event.getBlock().getLocation()));
for (int i=0 ; i<event.getLines().length ; i++)
bw.write("\n" + "Line " + i + ": " + event.getLines()[i]);
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();
}
@ -931,4 +982,3 @@ public class MapParser extends JavaPlugin implements Listener
}
}
}
}