From c367dfa510845167a2f5805758f08beb59c4bd6a Mon Sep 17 00:00:00 2001 From: boy0001 Date: Fri, 24 Oct 2014 16:50:48 +1100 Subject: [PATCH] Added plot info categories. --- .../jnbt/ByteArrayTag.java | 19 --- .../intellectualcrafters/jnbt/ByteTag.java | 19 --- .../jnbt/CompoundTag.java | 19 --- .../jnbt/CompoundTagBuilder.java | 19 --- .../intellectualcrafters/jnbt/DoubleTag.java | 19 --- .../com/intellectualcrafters/jnbt/EndTag.java | 19 --- .../intellectualcrafters/jnbt/FloatTag.java | 19 --- .../jnbt/IntArrayTag.java | 19 --- .../com/intellectualcrafters/jnbt/IntTag.java | 19 --- .../intellectualcrafters/jnbt/ListTag.java | 19 --- .../jnbt/ListTagBuilder.java | 19 --- .../intellectualcrafters/jnbt/LongTag.java | 19 --- .../jnbt/NBTConstants.java | 19 --- .../jnbt/NBTInputStream.java | 19 --- .../jnbt/NBTOutputStream.java | 19 --- .../intellectualcrafters/jnbt/NBTUtils.java | 29 +---- .../intellectualcrafters/jnbt/ShortTag.java | 19 --- .../intellectualcrafters/jnbt/StringTag.java | 19 --- .../com/intellectualcrafters/jnbt/Tag.java | 19 --- .../src/com/intellectualcrafters/plot/C.java | 14 ++- .../plot/commands/Info.java | 112 ++++++++++++++---- .../plot/commands/list.java | 2 +- 22 files changed, 108 insertions(+), 391 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/ByteArrayTag.java b/PlotSquared/src/com/intellectualcrafters/jnbt/ByteArrayTag.java index c6efbd9cb..4d0d89322 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/ByteArrayTag.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/ByteArrayTag.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; /** diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/ByteTag.java b/PlotSquared/src/com/intellectualcrafters/jnbt/ByteTag.java index 65e86ec84..46e247e63 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/ByteTag.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/ByteTag.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; /** diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/CompoundTag.java b/PlotSquared/src/com/intellectualcrafters/jnbt/CompoundTag.java index 13dad7121..2052d65b3 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/CompoundTag.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/CompoundTag.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; import java.util.Collections; diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/CompoundTagBuilder.java b/PlotSquared/src/com/intellectualcrafters/jnbt/CompoundTagBuilder.java index 8f1edf183..bdca78428 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/CompoundTagBuilder.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/CompoundTagBuilder.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; import java.util.HashMap; diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/DoubleTag.java b/PlotSquared/src/com/intellectualcrafters/jnbt/DoubleTag.java index e3c9028d6..b660eb681 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/DoubleTag.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/DoubleTag.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; /** diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/EndTag.java b/PlotSquared/src/com/intellectualcrafters/jnbt/EndTag.java index f4a6b49e4..408206b1b 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/EndTag.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/EndTag.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; /** diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/FloatTag.java b/PlotSquared/src/com/intellectualcrafters/jnbt/FloatTag.java index 9d75964c0..ad333dad1 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/FloatTag.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/FloatTag.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; /** diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/IntArrayTag.java b/PlotSquared/src/com/intellectualcrafters/jnbt/IntArrayTag.java index 3359b393a..4c80b1cf7 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/IntArrayTag.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/IntArrayTag.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/IntTag.java b/PlotSquared/src/com/intellectualcrafters/jnbt/IntTag.java index d272cfa15..bea176238 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/IntTag.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/IntTag.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; /** diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/ListTag.java b/PlotSquared/src/com/intellectualcrafters/jnbt/ListTag.java index 8d36aea43..bea5d8158 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/ListTag.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/ListTag.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; import javax.annotation.Nullable; diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/ListTagBuilder.java b/PlotSquared/src/com/intellectualcrafters/jnbt/ListTagBuilder.java index 711e5629e..758bc52eb 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/ListTagBuilder.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/ListTagBuilder.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; import java.util.ArrayList; diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/LongTag.java b/PlotSquared/src/com/intellectualcrafters/jnbt/LongTag.java index 839b0f0cf..19ab6b44f 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/LongTag.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/LongTag.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; /** diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/NBTConstants.java b/PlotSquared/src/com/intellectualcrafters/jnbt/NBTConstants.java index d8b5544f9..f1bef6d4f 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/NBTConstants.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/NBTConstants.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; import java.nio.charset.Charset; diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/NBTInputStream.java b/PlotSquared/src/com/intellectualcrafters/jnbt/NBTInputStream.java index a412a4d74..fc6609f35 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/NBTInputStream.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/NBTInputStream.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; import java.io.Closeable; diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/NBTOutputStream.java b/PlotSquared/src/com/intellectualcrafters/jnbt/NBTOutputStream.java index c982d7817..dc915bcf4 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/NBTOutputStream.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/NBTOutputStream.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; import java.io.Closeable; diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/NBTUtils.java b/PlotSquared/src/com/intellectualcrafters/jnbt/NBTUtils.java index 19a62bfb6..611f109df 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/NBTUtils.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/NBTUtils.java @@ -1,30 +1,7 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; import java.util.Map; -import com.sun.media.sound.InvalidFormatException; - -import static com.google.common.base.Preconditions.checkNotNull; - /** * A class which contains NBT-related utility methods. * @@ -160,13 +137,13 @@ public final class NBTUtils { * @return child tag * @throws InvalidFormatException */ - public static T getChildTag(Map items, String key, Class expected) throws InvalidFormatException { + public static T getChildTag(Map items, String key, Class expected) throws IllegalArgumentException { if (!items.containsKey(key)) { - throw new InvalidFormatException("Missing a \"" + key + "\" tag"); + throw new IllegalArgumentException("Missing a \"" + key + "\" tag"); } Tag tag = items.get(key); if (!expected.isInstance(tag)) { - throw new InvalidFormatException(key + " tag is not of tag type " + expected.getName()); + throw new IllegalArgumentException(key + " tag is not of tag type " + expected.getName()); } return expected.cast(tag); } diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/ShortTag.java b/PlotSquared/src/com/intellectualcrafters/jnbt/ShortTag.java index c48e4198b..e488968d1 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/ShortTag.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/ShortTag.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; /** diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/StringTag.java b/PlotSquared/src/com/intellectualcrafters/jnbt/StringTag.java index 1e5c06a98..6a66458eb 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/StringTag.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/StringTag.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/PlotSquared/src/com/intellectualcrafters/jnbt/Tag.java b/PlotSquared/src/com/intellectualcrafters/jnbt/Tag.java index a1ea70e83..2fab21bd2 100644 --- a/PlotSquared/src/com/intellectualcrafters/jnbt/Tag.java +++ b/PlotSquared/src/com/intellectualcrafters/jnbt/Tag.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - package com.intellectualcrafters.jnbt; /** diff --git a/PlotSquared/src/com/intellectualcrafters/plot/C.java b/PlotSquared/src/com/intellectualcrafters/plot/C.java index 41be88e8b..271b0404c 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/C.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/C.java @@ -207,7 +207,19 @@ public enum C { * Info */ PLOT_INFO_UNCLAIMED("&cPlot &6%s&c is not yet claimed"), - PLOT_INFO("ID: &6%id%&c, Alias: &6%alias%&c, Owner: &6%owner%&c, Biome: &6%biome%&c, Helpers:&6%helpers%&c, Trusted:&6%trusted%&c, Denied:&6%denied%&c, Rating: &6%rating%&c, Flags: &6%flags%"), + PLOT_INFO("&6ID&7: &a%id%&7\n&6Alias&7: &a%alias%\n&6Owner&7: &a%owner%\n&6Description&7: &a%desc%\n&6Rating&7: &a%rating%&7/&a10\n&6Can build&7: &a%build%"), + + PLOT_INFO_HELPERS("&6Helpers&7: %helpers%"), + PLOT_INFO_TRUSTED("&6Trusted&7: %trusted%"), + PLOT_INFO_DENIED("&6DENIED&7: %denied%"), + PLOT_INFO_FLAGS("&6Flags&7: %flags%"), + PLOT_INFO_BIOME("&6Biome&7: %biome%"), + PLOT_INFO_RATING("&6Rating&7: %rating%"), + PLOT_INFO_OWNER("&6Owner&7: %owner%"), + PLOT_INFO_ID("&6ID&7: %id%"), + PLOT_INFO_ALIAS("&6Alias&7: %alias%"), + PLOT_INFO_SIZE("&6Size&7: %size%"), + PLOT_USER_LIST(" &6%user%&c,"), INFO_SYNTAX_CONSOLE("/plot info X;Y"), /* diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Info.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Info.java index caf3f5189..eea11751a 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Info.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Info.java @@ -10,7 +10,9 @@ package com.intellectualcrafters.plot.commands; import com.intellectualcrafters.plot.*; import com.intellectualcrafters.plot.database.DBFunc; + import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.time.DateUtils; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; @@ -31,9 +33,10 @@ public class Info extends SubCommand { @Override public boolean execute(Player player, String... args) { - + World world; Plot plot; if (player!=null) { + world = player.getWorld(); if (!PlayerFunctions.isInPlot(player)) { PlayerFunctions.sendMessage(player, C.NOT_IN_PLOT); return false; @@ -41,7 +44,7 @@ public class Info extends SubCommand { plot = PlayerFunctions.getCurrentPlot(player); } else { - if (args.length!=2) { + if (args.length<2) { PlayerFunctions.sendMessage(player, C.INFO_SYNTAX_CONSOLE); return false; } @@ -56,6 +59,14 @@ public class Info extends SubCommand { plot = PlotHelper.getPlot(Bukkit.getWorld(plotworld.worldname), id); if (plot==null) { PlayerFunctions.sendMessage(player, C.NOT_VALID_PLOT_ID); + return false; + } + world = Bukkit.getWorld(args[0]); + if (args.length==3) { + args = new String[] {args[2]}; + } + else { + args = new String[0]; } } catch (Exception e) { @@ -90,8 +101,6 @@ public class Info extends SubCommand { return true; } - new StringBuilder(); - String owner = "none"; if (plot.owner != null) { owner = Bukkit.getOfflinePlayer(plot.owner).getName(); @@ -99,27 +108,88 @@ public class Info extends SubCommand { if (owner == null) { owner = plot.owner.toString(); } - String info = C.PLOT_INFO.s(); - info = info.replaceAll("%alias%", plot.settings.getAlias().length() > 0 ? plot.settings.getAlias() : "none"); - info = info.replaceAll("%id%", plot.id.toString()); - info = info.replaceAll("%biome%", getBiomeAt(plot).toString()); - info = info.replaceAll("%owner%", owner); - info = info.replaceAll("%helpers%", getPlayerList(plot.helpers)); - info = info.replaceAll("%trusted%", getPlayerList(plot.trusted)); - info = info.replaceAll("%denied%", getPlayerList(plot.denied)); - info = info.replaceAll("%rating%", "" + DBFunc.getRatings(plot)); - info = - info.replaceAll("%flags%", StringUtils.join(plot.settings.getFlags(), "").length() > 0 - ? StringUtils.join(plot.settings.getFlags(), ",") : "none"); - // PlayerFunctions.sendMessage(player, - // PlayerFunctions.getTopPlot(player.getWorld(), plot).id.toString()); - // PlayerFunctions.sendMessage(player, - // PlayerFunctions.getBottomPlot(player.getWorld(), - // plot).id.toString()); + + if (args.length==1) { + info = getCaption(args[0].toLowerCase()); + if (info==null) { + PlayerFunctions.sendMessage(player, "&6Categories&7: &ahelpers&7, &aalias&7, &abiome&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, &aowner&7, &arating"); + return false; + } + } + + info = format(info, world, plot, player); + PlayerFunctions.sendMessage(player, info); return true; } + + private String getCaption(String string) { + switch (string) { + case "helpers": + return C.PLOT_INFO_HELPERS.s(); + case "alias": + return C.PLOT_INFO_ALIAS.s(); + case "biome": + return C.PLOT_INFO_BIOME.s(); + case "denied": + return C.PLOT_INFO_DENIED.s(); + case "flags": + return C.PLOT_INFO_FLAGS.s(); + case "id": + return C.PLOT_INFO_ID.s(); + case "size": + return C.PLOT_INFO_SIZE.s(); + case "trusted": + return C.PLOT_INFO_TRUSTED.s(); + case "owner": + return C.PLOT_INFO_OWNER.s(); + case "rating": + return C.PLOT_INFO_RATING.s(); + default: + return null; + } + } + + private String format(String info, World world, Plot plot, Player player) { + + PlotId id = plot.id; + PlotId id2 = PlayerFunctions.getTopPlot(world, plot).id; + int num = PlayerFunctions.getPlotSelectionIds(world, id, id2).size(); + String alias = plot.settings.getAlias().length() > 0 ? plot.settings.getAlias() : "none"; + String biome = getBiomeAt(plot).toString(); + String helpers = getPlayerList(plot.helpers); + String trusted = getPlayerList(plot.trusted); + String denied = getPlayerList(plot.denied); + String rating = String.format("%.1f", DBFunc.getRatings(plot)); + String flags = StringUtils.join(plot.settings.getFlags(), "").length() > 0 ? StringUtils.join(plot.settings.getFlags(), ",") : "none"; + boolean build = player==null ? true : plot.hasRights(player); + + String owner = "none"; + if (plot.owner != null) { + owner = Bukkit.getOfflinePlayer(plot.owner).getName(); + } + if (owner == null) { + owner = plot.owner.toString(); + } + + info = info.replaceAll("%alias%", alias); + info = info.replaceAll("%id%", id.toString()); + info = info.replaceAll("%id2%", id2.toString()); + info = info.replaceAll("%num%", num+""); + info = info.replaceAll("%biome%", biome); + info = info.replaceAll("%owner%", owner); + info = info.replaceAll("%helpers%", helpers); + info = info.replaceAll("%trusted%", trusted); + info = info.replaceAll("%denied%", denied); + info = info.replaceAll("%rating%", rating); + info = info.replaceAll("%flags%", flags); + info = info.replaceAll("%build%", build+""); + info = info.replaceAll("%desc%", "No description set."); + + + return info; + } private String getPlayerList(ArrayList l) { if ((l == null) || (l.size() < 1)) { diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/list.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/list.java index f60431414..df09855e6 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/list.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/list.java @@ -72,7 +72,7 @@ public class list extends SubCommand { + "\n"); } } - string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", PlotMain.getPlots().size() + string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There are").replaceAll("%num%", PlotMain.getPlots().size() + "").replaceAll("%plot%", PlotMain.getPlots().size() == 1 ? "plot" : "plots")); PlayerFunctions.sendMessage(plr, string.toString()); return true;