Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2015-11-01 22:09:58 -06:00
commit 55d028d706
3 changed files with 81 additions and 27 deletions

View File

@ -131,7 +131,7 @@ public class FriendsGUI implements Listener
ItemBuilder builder = new ItemBuilder(Material.SKULL_ITEM, 1, (short) (friend.Online ? 3 : 0)); ItemBuilder builder = new ItemBuilder(Material.SKULL_ITEM, 1, (short) (friend.Online ? 3 : 0));
builder.setTitle(C.cWhite + C.Bold + friend.Name); builder.setTitle(C.cWhite + C.Bold + friend.Name);
builder.setPlayerHead(friend.Name); // builder.setPlayerHead(friend.Name);
builder.addLore(C.cGray + C.Bold + "Status: " + (friend.Online ? C.cDGreen + "Online" : C.cRed + "Offline")); builder.addLore(C.cGray + C.Bold + "Status: " + (friend.Online ? C.cDGreen + "Online" : C.cRed + "Offline"));
@ -276,7 +276,7 @@ public class FriendsGUI implements Listener
ItemBuilder builder = new ItemBuilder(Material.SKULL_ITEM, 1, (short) (friend.Online ? 3 : 0)); ItemBuilder builder = new ItemBuilder(Material.SKULL_ITEM, 1, (short) (friend.Online ? 3 : 0));
builder.setTitle(C.cWhite + C.Bold + friend.Name); builder.setTitle(C.cWhite + C.Bold + friend.Name);
builder.setPlayerHead(friend.Name); // builder.setPlayerHead(friend.Name);
builder.addLore(C.cGray + C.Bold + "Status: " + (friend.Online ? C.cDGreen + "Online" : C.cRed + "Offline")); builder.addLore(C.cGray + C.Bold + "Status: " + (friend.Online ? C.cDGreen + "Online" : C.cRed + "Offline"));

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,14 +66,17 @@ 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())
{ {
if (player.equals(other)) if (player.equals(other))
continue; continue;
if(Manager.GetClients().Get(other).GetRank().has(Rank.MODERATOR))
hideMe = false;
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"); 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(world.getName() + "/" + "command_sign_log.txt");
if (!file.exists()) if (!file.exists())
file.createNewFile(); file.createNewFile();
FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); FileWriter fw = new FileWriter(file.getAbsoluteFile(), true);
BufferedWriter bw = new BufferedWriter(fw); BufferedWriter bw = new BufferedWriter(fw);
bw.write("\n\n"); bw.write("\n\n");
bw.write("\n" + "Date: " + UtilTime.now()); for (String line : text)
bw.write("\n" + "Player: " + event.getPlayer().getName()); bw.write("\n" + line);
bw.write("\n" + "Location: " + UtilWorld.locToStrClean(event.getBlock().getLocation()));
for (int i=0 ; i<event.getLines().length ; i++) bw.close();
bw.write("\n" + "Line " + i + ": " + event.getLines()[i]); }
catch (Exception e)
bw.close(); {
} e.printStackTrace();
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();
} }
} }
} }